Posts

Showing posts with the label React JS

Create the react element with JSX and Implement Click event in React App

Image
  In previous article we discussed how to create react app from scratch and we also discussed about the project structure of the react app.In this article i will be discussing about the how to create the react element with JSX and how to implement Click event in React App.       Create the react element with JSX:  In app.js file i will remove the default code returned in the App() method and add the following code. App.Js   import logo from './logo.svg'; import './App.css'; function App() { return ( <span>Hello world!</span> ) } export default App;  then run the below command: npm start  You will get the below output in browser.  now i try to add another span then the below error will be shown in VS Code:  this error is because in react you should have one parent element and under that you can have unlimited child elements. So you need to add the parent div element under that you can add both the span like below example

Getting started with react JS step by step from scratch

Image
 In this article we will be discussing how to create react app from scratch. We will also discuss about the project structure of react app. React JS is an library but most people says its an framework. Its actually an library by using it we can develop robust applications.     For react app we need to have install Node Js on development machine. To download Node JS you can visit below link and install it on your machine. https://nodejs.org/en/download/     I recommend you to always download LTS (Long term support) executable versions only.   Now we have downloaded and installed the node JS, its time to download and install the code editor to manage your code efficiently. I would recommend you that you can go with the Visual studio code. following is the link to download the visual studio code.   https://code.visualstudio.com/   Now we have downloaded and installed visual studio code as well as Node JS. Lets launch the visual studio code, go to menu bar and click on Terminal option >