A quick and efficient guide for users who want to get their first application running locally with minimal effort and time using create-react-app
What is React?
React is a powerful front-end library developed by Facebook to accelerate web development with powerful new capabilities such as Virtual DOM and JSX.
Despite the overwhelming popularity of React, users are often facing a common problem. Users often find the task of creating a new application using the React app to be cumbersome.
In this blog, we will go over how you can get your first application running locally within minutes without any hassle at all. This will allow you to quickly spin up all the tedious boilerplate and focus on learning this awesome tool.
The following are the prerequisites for successfully creating a new application with React:
VS Code https://code.visualstudio.com/
Steps to Get the Application Running
- Bring up the VS Code. Your window might look a little different but that is okay. All my instructions will work regardless.
- At the top of the screen in the toolbar, click ‘Terminal’ and then click ‘New Terminal’
- A terminal pane will show up on the bottom of your window.
- Type in the following command: npm install -g create-react-app
- Type in the following command: npx create-react-app mytestapp
- This will take some time. Please wait until this process finishes
- Once the process is complete, type in the following command: cd mytestapp
- Then type: ‘code -r .’ This will open the project you just created in your Visual Studio code window.
- You will see a similar screen like the one shown in the screenshot below. Stay strong. We are almost done!
- From the top ribbon menu, click on ‘Terminal’ and then click on ‘New Terminal’ from the drop-down menu.
- A terminal window will appear at the bottom of the screen. Type in the command ‘npm start’
- In a few seconds a browser window will pop up, showing the following:
- This is your project running on your browser!!
- Go back to your Visual Studio Code window and from the left side of the screen click ‘src’.
- Now click on ‘App.js’
- Find the line shown in the screenshot below:
- Delete the content of this line.
- Now type the following in the space created when you deleted the content:
‘I created my first app! Hello World!!!’
- After this, navigate to the left top of the screen and click ‘File’ and then click on ‘Save’ from the drop-down menu.
- Go back to your browser window, you should see your change refresh live! Congrats – you created and edited your first react app! This is a huge accomplishment.
There you have it. You have created and edited your first react application and got it running locally. You are now prepared to develop and code a full-fledged react application using this tutorial and continue your journey. If you have any confusion or questions about the process, leave a comment below!
Go forth and React!
If you have any question or queries, do not hesitate to reach out to us!