-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi, I found a reddit thread where you mention the possibility of adding strings as errors:
https://www.reddit.com/r/reactjs/comments/x4iipz/comment/imx220n/
"jsx-no-leaked-values/jsx-no-leaked-values": [
"error",
{
"string": true,
}
]
This would be really helpful in React Native because rendering strings in RN will cause a crash:
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md#rule-details
const Example = () => {
return (
<>
{0 && <Something />}
{/* React: renders undesired 0 */}
{/* React Native: crashes 💥 */}
{NaN && <Something />}
{/* React: renders undesired NaN */}
{/* React Native: crashes 💥 */}
{'' && <Something />}
{/* React: renders nothing */}
{/* React Native, with React < 18: crashes 💥 */}
</>
)
}
iway1
Metadata
Metadata
Assignees
Labels
No labels