Add React To A Website

React is a framework which is made by facebook. It’s very popular. So i try to learn react trough https://reactjs.org/docs/ and put in here. To add react library just add script like this, where you need to include babel.js so it can use jsx.

<script src="https://unpkg.com/react@16/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>

Because using jsx , so in the js file or inline you need to add attribute
type="text/babel" . Here is simple sample React Code :


View Demo

Reuse Component Sample


View Demo

You can use regular javascript

Or just using jsx

The two code is same above. You can see the compile JSX using this tool : https://babeljs.io/repl

Here is sample using JSX. Because using jsx , so in the js file or inline you need to add attribute
type="text/babel" . Here is simple sample React Code with JSX :


View Demo