React PropTypes vs. Flow

前端 未结 4 2011
既然无缘
既然无缘 2021-01-30 04:52

PropTypes and Flow cover similar things but are using different approaches. PropTypes can give you warnings during runtime, which can be helpful to quickly find malformed respon

4条回答
  •  终归单人心
    2021-01-30 05:33

    I believe the missed point here is that Flow is a static checker while PropTypes is a runtime checker, which means

    • Flow can intercept errors upstream while coding : it can theoretically miss some errors that you wont know about (if you didn't implemented flow enough in your project for example, or in case of deep nested objects)
    • PropTypes will catch them downstream while testing, so it wont ever miss

提交回复
热议问题