Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSteven mudie
5,523 PointsHow old is this video? ReactDom.render() doesn't work. although i got it to show by placing title in function App()
function App() { return ( title ); }
export default App;
i am using npx create-react-app though
1 Answer
Dane Parchment
Treehouse Moderator 11,077 PointsReactDom.render()
definitely still works. Are you sure you have imported it into your file?
ReactDOM.render(element, container[, callback])
Above is the syntax for the method, make sure you are at least providing an element (Component) and a containing element to place that component in. If you are using create-react-app, then the index.js file should also be using the ReactDom.render()
method.
Like so:
ReactDom.render(<App />, document.getElementById('root'));