Thanks fr the great work here. I'm a newbie in react.js with some limited js skills. I'm trying to create a basic page with a header , a main and a footer. I wrote the code , console returned no error but nothing is showing up into browser. Here s the code :
js
const Header = ({title}) => (<header>{title}</header>);
const Main = ({title}) => (<main>{title}</main>);
const Footer = ({title}) => (<footer>{title}</footer>);
class App extends React.Component {
render() {
const {header,main,footer} = this.props;
return (
<div className="app">
<Header title={header} />
<Main title={main} />
<Footer title={footer}/>
</div>
);
}
};
ReactDOM.render(
<App
header="I am the header"
main="I am the main"
footer="I am the footer" />,
document.getElementById('react')
);
export default App;
html
<body>
<div id="react"></div>
</body>
console returned:
Compiled successfully!
You can now view wp in the browser.
http://localhost:38867/
Note that the development build is not optimized.
To create a production build, use npm run build.
And I got this :
What did I do wrong ? codeview here https://codepen.io/anon/pen/mmaxvj
EDIT : I forgot to add index.js. I edited it and changed ReactDOM.render(<App />, document.getElementById('root'));
to ReactDOM.render(<App />, document.getElementById('react'));
Now I have a blank page showing up and no more error on the browser... Any thoughts ?