4 ms·
You have to be careful with code like the above in React. Using a lower-cased function that returns JSX but is not rendered with react.createElement (either dir
by kwkelly 3y ago
You have to be careful with code like the above in React. Using a lower-cased function that returns JSX but is not rendered with react.createElement (either directly or via the JSX syntax) can lead to confusing violations of the rules of hooks as it relates to exact ordering of calls.
This is because it doesn't get registered as it's own component, so conditionally called children with hooks may cause errors.
- aabbcc1241 3y agoThe render function is a pure function returning jsx based on the input, not invoking any stateful operation like "functional hook". So this style of code is fine in react
- nonethewiser 3y agoDoes simply uppercasing it avoid these concerns?