propTypes use in react and some ways to avoid ๐Ÿ˜ซ๐Ÿ”ง Errors

krishna kakade - Mar 18 '20 - - Dev Community
import React,{Component} from  'react';
import propTypes from 'prop-types';
class TodoItem extends Component{
  render(){
      return(
<div>
<p>{this.props.todo.title}</p>

</div>
      )
  }
}

//proptypes used for what type of data need to be render out there in your code๐Ÿ”ฝ๐Ÿ•ถ
TodoItem.propTypes={
    todo:propTypes.object.isRequired
}

export default TodoItem;

Enter fullscreen mode Exit fullscreen mode

Mostly propTypes used to for rendering correct data means when you have to render number/object/array at that particular instance of code then you can do that thing by using propTypes. and that's all i know. and most important below๐Ÿ”ฝ๐Ÿ”ง and if you have something more then please comment๐Ÿ”ฝ

Mostlyall developers including big youtubers

they use this&done mistake๐Ÿ‘‰ import PropTypes from 'prop-types';
but for avoiding the errors we have to use ๐Ÿ”ฝ

import propTypes from 'prop-types';
Enter fullscreen mode Exit fullscreen mode

use propTypes and find issue related this hereClickMe๐Ÿ•ถ

Stay safe/clean God bless you all
follow Me On twitter

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player