Monday, March 4, 2019

ProtoTypes in react?

  • If you are developing big projects, you can catch a lot of bugs with typechecking

  • React has some built-in typechecking abilities          
 Ex:
we’re using PropTypes.string. When an invalid value is provided for a prop, a warning will be shown in the JavaScript console.

What is map() in react?

  • Higher order array method

  • Basically this is used for return array from an array.

     

    Ex:

    const numbers = [5, 10, 15, 20, 25];
    const doubled = numbers.map((number) => number / 5);
    console.log(doubled);