(value)
| 464 | } |
| 465 | |
| 466 | function testStringCoercion(value) { |
| 467 | // If you ended up here by following an exception call stack, here's what's |
| 468 | // happened: you supplied an object or symbol value to React (as a prop, key, |
| 469 | // DOM attribute, CSS property, string ref, etc.) and when React tried to |
| 470 | // coerce it to a string using `'' + value`, an exception was thrown. |
| 471 | // |
| 472 | // The most common types that will cause this exception are `Symbol` instances |
| 473 | // and Temporal objects like `Temporal.Instant`. But any object that has a |
| 474 | // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this |
| 475 | // exception. (Library authors do this to prevent users from using built-in |
| 476 | // numeric operators like `+` or comparison operators like `>=` because custom |
| 477 | // methods are needed to perform accurate arithmetic or comparison.) |
| 478 | // |
| 479 | // To fix the problem, coerce this object or symbol value to a string before |
| 480 | // passing it to React. The most reliable way is usually `String(value)`. |
| 481 | // |
| 482 | // To find which value is throwing, check the browser or debugger console. |
| 483 | // Before this exception was thrown, there should be `console.error` output |
| 484 | // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the |
| 485 | // problem and how that type was used: key, atrribute, input value prop, etc. |
| 486 | // In most cases, this console output also shows the component and its |
| 487 | // ancestor components where the exception happened. |
| 488 | // |
| 489 | // eslint-disable-next-line react-internal/safe-string-coercion |
| 490 | return '' + value; |
| 491 | } |
| 492 | function checkKeyStringCoercion(value) { |
| 493 | { |
| 494 | if (willCoercionThrow(value)) { |
no outgoing calls
no test coverage detected
searching dependent graphs…