tezvyn:

Write the React.createElement() equivalent for this JSX

Source: react.devadvanced

Tests JSX-to-JS compilation mechanics. Answer: createElement('a', {href: '/home', className: 'link'}, 'Go Home'). Children must be the third argument, not inside props. Red flag: nesting children in props or using an unquoted tag variable.

Tests whether you understand JSX as a syntactic transform rather than magic. A precise answer writes createElement('a', {href: '/home', className: 'link'}, 'Go Home'), placing the tag string first, attributes as a props object second, and text children as subsequent arguments. Strong candidates note that children are not inside the props object, that lowercase tags become quoted strings, and that multiple children become extra arguments or an array.

Read the original → react.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Write the React.createElement() equivalent for this JSX · Tezvyn