return function to reactDOM does nothing

97 views Asked by At

Why this doesn't work? I was following a youtube tutorial.

function Hello(props) {
  return <div>Hello</div>;
}

ReactDOM.render(
   Hello,
   document.getElementById('entry')
);

http://codepen.io/anon/pen/VmqJGp

1

There are 1 answers

0
loganfsmyth On BEST ANSWER

If you look at the JS console of that page you will see the following:

enter image description here

Following that link, the error page states

ReactDOM.render(): Invalid component element. Instead of passing a class like Foo, pass React.createElement(Foo) or <Foo />

so instead of

ReactDOM.render(
   Hello,
   document.getElementById('entry')
);

you should do

ReactDOM.render(
   <Hello />,
   document.getElementById('entry')
);