Key Points

React is fast, scalable, and simple. You can find few important concepts related to Javascript and React. Have a look at the cards.

Note: Some cards are having sample code.

Filter cards:

React Hooks

  • Introduced in React 16.8
  • Can be used to manage state
  • Easy and Reusable
  • No method bindings
  • Easy to manage comp lifecycle
  • Rule: Only inside functional comp
  • Rule: Must run in an order
  • Rule: Can not be used in condtions
  • Rule: On top level of the function
  • State Vs Props

  • State: Managed with in comp
  • State: Can be changed
  • Props: Get passed to the comp
  • Props: Immutable
  • Pure Functions

    Pure functions are functions that accept an input and returns a value without modifying any data outside its scope(Side Effects) and are deterministic. Ex: Reducers are just pure functions that take the previous state and an action, and return the next state.

    Reducers are Pure?

    Reducer takes the previous state and an action, and return the next state. Internally, Redux compares the reference of the prev state and the current state object, if we mutate the object then the reference of the object won't be changed. It means comparision always results to be true and state updation is not happend from redux

    Pure Components

    Pure Components in react are the components which do not re-renders when the value of state and props has been updated with the same values. Pure Components restricts the re-rendering ensuring the higher performance of the Component

    Reducer <-> Actions

    There is no relation between redcuer and action, many reducers can react to a single actions, a single reducer can react to multiple actions.