1

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?

2
  • 4
    Hey 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. Commented 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). Commented Jul 14, 2017 at 15:56

1 Answer 1

1

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'));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.