React: How to Create a New Project in the Current Directory

Updated: March 3, 2023 By: A Goodman Post a comment

If you’re using create-react-app then you can initialize a new project in the current directory with one of the following commands:

npx create-react-app .

Or:

npx create-react-app . --template typescript

The point here is to use a dot (.) to set the path. There are certain things that you must adhere to:

  • The folder name must not contain special characters, spaces, or capital letters. For example, kindacode-project is valid but KindaCode is invalid
  • If you have already created a project in the current directory, you cannot create another project

The project initialization process can take from a few tens of seconds to several tens of minutes, depending on your network speed and what your computer cache already has:

After successfully creating the project, you can launch it (without switching to another directory) with the following command:

npm start

That’s it. Hope you find the tutorial helpful in some ways.

Further reading:

You can also check our React category page and React Native category page for the latest tutorials and examples.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Related Articles