react-tutorial.app/app.html?id=366
1 Users
0 Comments
6 Highlights
0 Notes
Top Highlights
React.createElement takes all the arguments passed after the 2nd one and considers them children.
JavaScript will automatically insert a semi-colon after your return when it gets transformed from JSX to JavaScript,
he ; was added right after the return, which means that the function never reaches the React.createElement("ul", ...). This is the correct behavior of JavaScript as it requires compilers to automatically insert a semi-colon (if it doesn't already exist) after certain keywords
To avoid this issue, always return () and write the JSX elements inside the parentheses.
By opening the (), no semi-colon will be automatically inserted after return until the closing parenthesis is found, and you avoid unexpected issues.
JSX supports children Always wrap your JSX elements with () when written after a return.
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.