+ 1

Wrong exercise options

The exercise What is the output of this code? function Test(props) { return <p>{"A"+props.title}</p>; } const el = <Test title="X" />; ReactDOM.render( el, document.getElementById('root') ); the output on stack blitz is "A", not AX - as the answer suggests. As the code is compiled it gives an error of undefined variable. So by deleting the A from the line return <p>{"A"+props.title}</p>; . Substitute X by A or vice versa in the const el, and it works.

15th Oct 2020, 8:51 PM
Ivo Silva
Ivo Silva - avatar
2 Antworten
+ 4
I get AX on StackBlitz using the code you pasted from the lesson.
15th Oct 2020, 9:00 PM
MaddieL
MaddieL - avatar
15th Oct 2020, 9:29 PM
Kevin ★