Jessie Emerson
Jessie Emerson

Reputation: 743

return function to reactDOM does nothing

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

Upvotes: 1

Views: 89

Answers (1)

loganfsmyth
loganfsmyth

Reputation: 161457

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')
);

Upvotes: 2

Related Questions