10 Things to Know about React.js

react.js
  1. It’s a Library: React.js isn’t a framework like Angular or Vue. It’s a library focused on User Interfaces. It’s basically based on components. Currently React.js is the most popular library used in mordern Front End Devopment.
  2. JSX: JSX means JavaScript XML. It is used to write HTML code in React.js syntax. It makes the thing easier to write HTML in React.js. You can just use curly braces to use JSX in React code.

3. It’s JavaScript: You can use JavaScript inside a react component easily. You can just declare the variable and go forward. Some other frameworks needed templating language to use JavaScript inside them. But React is completely different and easy to use in this case.

4. All in One Place: You can use everything in one place in React component. You can use CSS in a HTML tag, even you can use JavaScript at the same time. That makes React.js developer friendly. Even if you want you can use them seperately too. So, it’s really comfortable for everyone who loves to keep things together or seperately.

5. Data Flows from Top to Bottom: In React component, data flows from top to bottom. That means it flows from parent to child component. And if you want to pass data from parent to child component then you’ve to use props. Props are considered as HTML attributes in JSX.

6. Using State: State is one of the most important thing in dynamic data loading. And state makes the work easier for a developer. First, state is used to keep the existing value of a variable and then it can be changed based on input. And to use state, we have to call useState method. And that should have an initial value.

7. Rendering: Every state change needs the rendering. When someone changes the state, it calls the render method and that changes in Virtual DOM to show it in browser. And child components also needs to re-render because their props changed in parent component.

8. Use Linting: Using ESLint to code in React makes so many things developer friendly. It makes words different color that can easily detect and troubleshoot. Linting makes code much cleaner.

9. Use Hooks: Using hook is another masterpiece in react. Someone can easily use hooks and avoid using class. It makes coding easier and someone can make hooks by himself.

10. Conditional Rendering: Conditional rendering is one of the top notch feature of React. And Ternary operator made it more easier. Sometimes we want to render one part of the markup conditionally and we use conditional rendering. Ternary operator is one of the mostly used conditional rendering system now a days. Ternary expressions are ?(if) :(else)

Happy Coding!!

Programmer || Web Developer || Learner || Practitioner

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store