简体   繁体   中英

Can anybody tell me why is my react code not working?

I am making a project on react. So, I didn't get too far(:-P). Well my problem is that ReactDOM.render() is not rendering my elements. I am relatively new to React, so cannot debug it. Here is it:-

https://codepen.io/shreyas23-sk/pen/LxRgwL

You have two errors in the code

  1. It's React.Component , not React.component

  2. In the render-function of the Header component, you have a new line after return - Javascript automatically adds a semicolon here, you can prevent this with either writing the first JSX-line after the return, or you can wrap your return statement in parentheses

So either write:

return (
  <div>
  ...
)

or

return <div>
  ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM