DEV Community

Cover image for Getting started with React
Ebenezer Awuku
Ebenezer Awuku

Posted on

Getting started with React

React is a popular JavaScript library for building user interfaces. To get started with React, you will need to have a basic understanding of JavaScript and some knowledge of HTML and CSS.

Here are the steps to get started with React:

  • Install Node.js on your computer. Node.js is a JavaScript runtime environment that allows you to run JavaScript on your computer outside of a web browser.

  • Install a code editor. A code editor is a program that allows you to write and edit code. Some popular options include Visual Studio Code, Atom, and Sublime Text.

  • Install the create-react-app package. The create-react-app package is a tool that creates a new React project for you. To install it, open a terminal window and run the following command:

npm install -g create-react-app

Enter fullscreen mode Exit fullscreen mode
  • Create a new React project. To create a new React project, open a terminal window, navigate to the directory where you want to create the project, and run the following command:
create-react-app my-app

Enter fullscreen mode Exit fullscreen mode
  • Start the development server. The development server is a program that runs on your computer and serves your app to a web browser. To start the development server, open a terminal window, navigate to the directory where you created your project, and run the following command:
cd my-app
npm start

Enter fullscreen mode Exit fullscreen mode
  • Open your app in a web browser. The development server will automatically open your app in a web browser at the URL http://localhost:3000. You should see a page with the react logo

At this point, you have a basic React app up and running. You can edit the code in your code editor and see the changes reflected in the web browser. To learn more about React, you can read the documentation at https://reactjs.org/docs/getting-started.html.

Top comments (0)