From bff8e3704928292d4643462dcef70266e382acd0 Mon Sep 17 00:00:00 2001 From: Jason Yung Date: Fri, 8 Feb 2019 10:53:38 -0500 Subject: [PATCH] Clarify ReactDOM.render usage (#34682) * Clarify ReactDOM.render usage demo code misleads campers into thinking that the second arg for ReactDOM.render is a string * Update index.md --- .../react/render-a-class-component-to-the-dom/index.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/guide/english/certifications/front-end-libraries/react/render-a-class-component-to-the-dom/index.md b/guide/english/certifications/front-end-libraries/react/render-a-class-component-to-the-dom/index.md index 227d9ec11f..18ac145351 100644 --- a/guide/english/certifications/front-end-libraries/react/render-a-class-component-to-the-dom/index.md +++ b/guide/english/certifications/front-end-libraries/react/render-a-class-component-to-the-dom/index.md @@ -20,13 +20,14 @@ class TypesOfVehicles extends React.Component { ); } } -ReactDOM.render(,'node-id') +ReactDOM.render(, document.getElementById('node-id')) ``` The ReactDOM.render syntax may be a little tricky, you need to use the triangle brackets when passing in a Class Component. Also the two subcomponents are declared behind the scenes, which may be confusing if you are used to all the variables being defined in the code editor and visible in front of you. -## Hint - - use document.getElementById('id') to get target node -## Relevant Link +### Hint + - use `document.getElementById('node-id')` to get target node whose id has the value 'node-id' +### Relevant Link + - [Rendering Elements](https://reactjs.org/docs/rendering-elements.html) ## Solution