DEV Community


10 things you need to know about ReactJs

Taieb Hossain
・2 min read

React is a javascript library. It is used for building user interfaces. I will discuss 10 important things that every react developer should know.

  1. Virtual Dom: In simple virtual dom is the copy of the actual dom. Every time a change happened to the dom, the virtual dom compares the virtual dom and the actual dom elements. If anything changes then update and display the change on the UI.

2.JSX: JSX means javascript XML. It makes it so easier to write HTML code in javascript. It looks like HTML but it rendered into regular javascript code.

  1. Default props: Default props is like javascript function default parameter. If any components props are not provided then default props are used in that.

  2. PropTypes: Sometimes a developer didn't do anything wrong but react app shows a warning. To avoid this you can use the
    prop types package.

  3. Performance optimization: Internally a react application has huge dom actions that can slow down your application. For this reason, you should use the minified version of your app. You can create a production build version to run the npm run build.

  4. Components: React is not a framework it is a tiny library of javascript. React is created to build a user interface on a web application nothing much. Every small piece of a web application should be a component. This could be a small button or any text etc.

  5. Expression: You can use any javascript expression in JSX using {} curly braces because JSX is not HTML it is javascript XML. Every JSX code translated into regular javascript.

  6. Stateful component: In react you can create a component with a state or without a state. The class component is a stateful component.

  7. Stateless component: In react stateless components are popular at this time. This is also called hook based component or functional component.

  8. Hooks: Hooks must be used in the functional components. you can't use hooks in the class component. In real all hooks are javascript functions that used in specific work.

Discussion (0)