The Introduction of React in Words
This week was the beginning of my journey with React, which I think will be not a short one. I had heard about it before, but I had known totally nothing about it.
I have learned that React is a JavaScript library created by Facebook. Its purpose is to make a complex and interactive user interface. It depends on the concept of the component, which is a block of code that can do only 1 thing.
To build a React component we should:
- Import React from “react”.
- Create a function (prefer to be in a separate file), its name will be the component name.
- Export this component to enable it to be imported to use it.
We can note the following:
- The keywords (import and export) should be small letters.
- The component name and the keyword React should start with a capital letter.
- The function should return only one object, and if we need our component to include more than one tag, we should encapsulate them inside a container tag like a div, for example.
Now, our component is ready to be imported and use.