How can I declare a PropType corresponding to a nullable number?

后端 未结 4 618
时光取名叫无心
时光取名叫无心 2021-02-02 05:26

I\'m looking for a PropType that means

\"this is required, and it will either be a number or be null\"

In other words,

4条回答
  •  清歌不尽
    2021-02-02 05:50

    You simply could use:

    PropTypes.number

    and in defaultProps:

    yourPropName: null

提交回复
热议问题