Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Web Browser
Components and Advanced JSX

Use a Variable Attribute in a Component

Take a look at this JavaScript object named redPanda:

const redPanda = { src: '', alt: 'Red Panda', width: '200px };

How could you render a React component, and get a picture with redPanda's properties?

Select RedPanda.js to see one way to do it.

Note all of the curly-brace JavaScript injections inside of the render function! Lines 16, 17, and 18 all use JavaScript injections.

You can, and often will, inject JavaScript into JSX inside of a render function.

Report a Bug
If you see a bug or any other issue with this page, please report it here.