How to use react?

Now, after learning react, how can i use it locally?The lesson about react talked about a transpiler called babel, but how to implement this transpiler, and should i create an html file then write jsx inside a <script> tag and that’s it, please if somebody can explain thanks

You can refer to the online documentation on how to get started and see what’s best work for you.

Alternatively, you can use create-react-app and set up a modern local environment with all you need for starter.

Hope it helps :sparkles:

1 Like

Yeah, create-react-app is the way to go when starting, I think, so you can worry about coding and not setting up and webpack, etc. Just follow the simple instructions and have a working app template in a few minutes.

1 Like

As an absolute beginner i find that confusing, when i see tutorials talking about using npm, node, etc …, to set up the environment for react and i am still a newbie trying to learn front-end first…

I find the react documentation to be pretty helpful.

It sounds like maybe you are nervous about working with the command line.
Is that true?

1 Like

It’s just that i didn’t go through back-end technologies yet, and when i see those tutorials include those technologies, i feel unfamiliar and confused…

Yeah, it’s a lot.

Yeah, node is a backend thing, but we can also use it as environment for frontend development. You use create-react-app in a node environment and then build the files you need for a frontend.

So yes, you will need to have node set up on your computer (if it isn’t already). I would look for videos on these subjects. There are people that will walk you through setting up node (or follow the instructions on the node site) and through setting up your first CRA app. And if you haven’t done any local/node dev before that might be worthwhile to see all the cool things like import/export you can do now.

2 Likes

Don’t be afraid of node - it’s just JavaScript, it just runs in your terminal instead of your browser. You don’t need to know how to set up a server and all the backend stuff to use the node environment to develop frontend stuff. Really, it’s a lot easier than you’re thinking. I remember being where you are - just watch some videos and it will start to make more sense.

1 Like

This could be a good video. I always liked his videos. He uses CRA and talks about setting up node, and walks you through a simple app. If you are familiar with React, you can probably skip over the first 9:35.

Watching these videos and coding along were a big part of my learning. I especially liked Traversy’s videos - he goes slowly and explains as he goes.

1 Like

Thank you very much for spending your time, Very appreciated, thanks!

Using create-react-app is super simple. You do need Nodejs and npm installed first but you will need that no matter what. Soon enough you will learn to hate node_modules, trust me. The code bloat we have to deal with for even the simplest npm packages is ridiculous at this point. And then you have the constant updates to the packages/dependencies, it’s a right pain in the behind.

If you need a quick React playground Codesandbox is a great way to go, they have starter templates based on create-react-app so you won’t have to spin up a new create-react-app locally every time you want to test something.

Good luck and happy coding!

1 Like