Im starting coding reactjs and im confusing how html5 work on reactjs. Do we need to build a separate html5 sheet or code html5 direct into jsx sheet?
-
4Hey there friend! Welcome to Stackoverflow. Please take some time to read the help page, especially the Stack Overflow question checklist and how to post questions that include Minimal, Complete, and Verifiable Examples. As it currently stands, your question is way to vague for anyone to help you.Chris– Chris2017-07-14 10:10:16 +00:00Commented Jul 14, 2017 at 10:10
-
Also please take a time to go through the welcome tour to know your way around here (and also to earn your first badge).DarkCygnus– DarkCygnus2017-07-14 15:56:02 +00:00Commented Jul 14, 2017 at 15:56
Add a comment
|
1 Answer
React is component based java-script lib. so on your html code just link jsx by main.js code structure. your xml code build and make application in the extension of JSX like App.jsx . Refer here to build react app
index.html
This is just regular HTML. We are setting div id = "app" as a root element for our app and adding index.js script which is our bundled app file.
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset = "UTF-8">
<title>React App</title>
</head>
<body>
<div id = "app"></div>
<script src = "index.js"></script>
</body>
</html>
App.jsx
import React from 'react';
class App extends React.Component {
render() {
return (
<div>
Hello World!!!
</div>
);
}
}
export default App;
main.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
ReactDOM.render(<App />, document.getElementById('app'));