You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to this tutorial series on ReactJS! This tutorial aims to teach you the fundamentals of the ReactJS front-end library so you can learn how to build your own projects with ReactJS. By the end of this tutorial series you will have built a front-end application like this:
14
13
15
14
<Centerer>
16
-
<imgsrc="https://imgur.com/sfHTEm4.png"alt="Final product of this this tutorial series"width="70%" />
15
+
<img
16
+
src="https://imgur.com/sfHTEm4.png"
17
+
alt="Final product of this this tutorial series"
18
+
width="70%"
19
+
/>
17
20
</Centerer>
18
21
19
22
ReactJS is a front-end JavaScript library for building user interfaces for websites, dynamic web applications, mobile apps, and many other places that need a visual interface for users to interact with software. It was released in 2013 and since then it has become by far the most popular tool for building web applications. It is made and maintained by Facebook/Meta and is used for many commercial apps and websites like Facebook, Instagram, Airbnb and Uber Eats. Needless to say, ReactJS is currently widely used in industry and there are huge swathes of positions in the tech industry for ReactJS developers. So learning ReactJS will give you valuable front-end UI development skills, and also make you highly employable for many years before the next big front-end framework takes its place.
@@ -28,5 +31,4 @@ If you're ready, learn to build a mini React application starting in the <Link h
Copy file name to clipboardExpand all lines: data/articles/reactjs-tut-1.mdx
+17-8
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,7 @@ $ node -v
40
40
and press enter. This tests whether you have installed NodeJS correctly. If you have, it should print the version of NodeJS which you have installed, such as `16.15.0`.
41
41
42
42
## NPM - Node Package Manager
43
+
43
44
Installing NodeJS also automatically installs NPM (Node Package Manager) which manages JavaScript packages for your projects. To check that it has installed properly, type into your command line:
44
45
45
46
```bash:
@@ -82,30 +83,38 @@ $ cd reactjs-project-tutorial
82
83
Also open up the project in VSCode by opening up VSCode and opening the folder <FileName>reactjs-project-tutorial</FileName>.
83
84
84
85
<Centerer>
85
-
<imgalt="Open VSCode and open a folder"src="https://imgur.com/T6kP1ov.png"width="80%" />
86
+
<img
87
+
alt="Open VSCode and open a folder"
88
+
src="https://imgur.com/T6kP1ov.png"
89
+
width="80%"
90
+
/>
86
91
</Centerer>
87
92
88
93
<Centerer>
89
-
<imgalt="Select the my-react-app folder"src="https://imgur.com/vts088y.png"width="80%" />
94
+
<img
95
+
alt="Select the my-react-app folder"
96
+
src="https://imgur.com/vts088y.png"
97
+
width="80%"
98
+
/>
90
99
</Centerer>
91
100
92
101
You should now be able to see the source code of your new React app in your code editor!
93
102
94
103
<Centerer>
95
-
<imgalt="Your React source code app in VSCode"src="https://i.imgur.com/0uACQX4.png"width="80%" />
104
+
<img
105
+
alt="Your React source code app in VSCode"
106
+
src="https://i.imgur.com/0uACQX4.png"
107
+
width="80%"
108
+
/>
96
109
</Centerer>
97
110
98
111
In the <Linkhref="/articles/reactjs-tut-2">next tutorial</Link> we'll explore all the different parts of the code that create-react-app has given to us.
Copy file name to clipboardExpand all lines: data/articles/reactjs-tut-2.mdx
+1-3
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,6 @@ In the last tutorial you installed all the tools we'll need to create a React ap
22
22
install it.
23
23
</Callout>
24
24
25
-
26
25
The <FileName>README.md</FileName> file at the bottom has a brief description of this repository and how to use it. The <FileName>.md</FileName> extension stands for _markdown_, a common text editing syntax to format text. It is not code; markdown is to make text readable for humans.
27
26
28
27
In general you should use a <FileName>README.md</FileName> in a project to give an overview of what your project does, how to use it, and any other information you think would be useful for people interested in your code.
Copy file name to clipboardExpand all lines: data/articles/reactjs-tut-4.mdx
+2-3
Original file line number
Diff line number
Diff line change
@@ -286,13 +286,12 @@ const App = () => {
286
286
287
287
Currently we have effectively "hard-coded" the restaurant information into our app. We want to be able to dynamically store and change this information. We will learn how to do this in the <Linkhref="/articles/reactjs-tut-5">next tutorial</Link>.
Variables are a fundamental concept in programming because it allows us to store and modify data depending on where or how our program is used. In a React app, variables are made using something called the `useState` hook. React hooks are functions that can be called from within our functional components like `App` to use various core React features.
13
13
14
14
<Callouttype="note">
15
-
The tutorial starts getting a bit tricky here. If you get lost at any point, take a look at the sample implementation at [github.com/dqna64/reactjs-project-tutorial/tree/full-walkthrough](https://github.com/dqna64/reactjs-project-tutorial/tree/full-walkthrough).
15
+
The tutorial starts getting a bit tricky here. If you get lost at any point,
To use the `useState` hook, first import it into our <FileName>App.jsx</FileName> file. Then inside the `App` functional component and above the return statement, write the following:
Copy file name to clipboardExpand all lines: data/articles/reactjs-tut-6.mdx
+7-4
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,11 @@ Just like how functions in programming can separate responsibilities and elimina
16
16
Make a new <FileName>components </FileName> folder in <FileName>src </FileName>. This new folder will store any reusable components that we create. Inside <FileName>src/components </FileName> create a file <FileName>Card.jsx </FileName> and add in this template for a basic React component:
We want this `Card` component to render the restaurant card we made in <FileName>App.jsx </FileName>. Cut and paste that JSX into the return of this `Card` component. Remember to wrap it in parentheses. Also be sure to move the star.svg and <FileName>Card.css </FileName> imports from <FileName>App.jsx </FileName> to <FileName>Card.jsx </FileName> (hint: the path from <FileName>Card.jsx </FileName> to <FileName>Card.css </FileName> is <FileName>"../styles/Card.css" </FileName> where ".." means "the parent folder of the folder that contains this file").
@@ -248,12 +252,11 @@ Our app now renders a list of cards of all restaurants specfied in the `places`
248
252
249
253
That's all for this series of tutorials, well done on making it to the end! The fundamental concepts that you have learned here including components, props and state will be useful in all future ReactJS projects that you work on.
250
254
251
-
There are also many more things to learn which we haven't covered in this series. What if you want to provide a form to add more restaurants, or increase `visits` count for a restaurant? These features can be achieved using things called *event handlers*, which ReactJS does very similarly to HTML. There are plenty of resources online including other articles, videos and documentation to teach you those things. The best way to learn how to use them is to continue building projects and searching the internet for learning resources like these whenever you get stuck. Good luck on your ReactJS journey and have fun!
255
+
There are also many more things to learn which we haven't covered in this series. What if you want to provide a form to add more restaurants, or increase `visits` count for a restaurant? These features can be achieved using things called _event handlers_, which ReactJS does very similarly to HTML. There are plenty of resources online including other articles, videos and documentation to teach you those things. The best way to learn how to use them is to continue building projects and searching the internet for learning resources like these whenever you get stuck. Good luck on your ReactJS journey and have fun!
0 commit comments