Prerequisites for react js: HTML and CSS: React is primarily used to build user interfaces, and a good understanding of HTML for structuring content and CSS for styling is crucial.
JavaScript (ES6+): React is a JavaScript library, and a good grasp of JavaScript is essential. Familiarity with ES6+ features like arrow functions, classes, destructuring, and moduls will be particularly helpful.
Let's create a simple React.js program that displays a "Hello, React!" message. We'll use the Create React App tool to set up our project. If you haven't installed it yet, you can do so by running the following command in your terminal:
- npx create-react-app my-first-react-app
- cd my-first-react-app
- npm start
these 3 steps are to create a react simple app
Printing hello world on react js:
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
<h1> Hello this is my first react js </h1>
</header>
</div>
);
}
export default App;
Tags:
ReactJs