MCPcopy Create free account
hub / github.com/plotly/dash / testStringCoercion

Function testStringCoercion

dash/deps/react-dom@18.3.1.js:222–247  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

220 }
221
222 function testStringCoercion(value) {
223 // If you ended up here by following an exception call stack, here's what's
224 // happened: you supplied an object or symbol value to React (as a prop, key,
225 // DOM attribute, CSS property, string ref, etc.) and when React tried to
226 // coerce it to a string using `'' + value`, an exception was thrown.
227 //
228 // The most common types that will cause this exception are `Symbol` instances
229 // and Temporal objects like `Temporal.Instant`. But any object that has a
230 // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
231 // exception. (Library authors do this to prevent users from using built-in
232 // numeric operators like `+` or comparison operators like `>=` because custom
233 // methods are needed to perform accurate arithmetic or comparison.)
234 //
235 // To fix the problem, coerce this object or symbol value to a string before
236 // passing it to React. The most reliable way is usually `String(value)`.
237 //
238 // To find which value is throwing, check the browser or debugger console.
239 // Before this exception was thrown, there should be `console.error` output
240 // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
241 // problem and how that type was used: key, atrribute, input value prop, etc.
242 // In most cases, this console output also shows the component and its
243 // ancestor components where the exception happened.
244 //
245 // eslint-disable-next-line react-internal/safe-string-coercion
246 return '' + value;
247 }
248
249 function checkAttributeStringCoercion(value, attributeName) {
250 {

Callers 7

willCoercionThrowFunction · 0.70
checkKeyStringCoercionFunction · 0.70
checkPropStringCoercionFunction · 0.70
checkHtmlStringCoercionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…