Wali faizy Wali faizy - 2 months ago 10
React JSX Question

React hello world progrma is not working


As i am new to react and i am trying to make react a simple hello world in react but it is saying React.render is not a function


<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://unpkg.com/react@15.3.1/dist/react.min.js"></script>
<script src="https://unpkg.com/react-dom@15.3.1/dist/react-dom.min.js"></script>




<body>
<script>
React.render(React.createElement('div', null, 'Hello World'),document.body);
</script>



Answer

What used to be React.render() is now called ReactDOM.render():

ReactDOM.render(React.createElement('div', null, 'Hello World'),document.body)