mardi 6 mars 2018

What are the scenarios one should use isRequired for PropType vs defaultProps in React Application

I constantly struggle to understand, when exactly should I be using .isRequred vs .defaultProps={...} My thought is that, I think I should never ever really need to use isRequired, because it seems manually creating a bug that can break in the application because create isRequired automatically remove the need to add a corresponding default prop, that makes me feel uncomfortable just because it means I won't be able to expect a fail-safe value.

It definately sounds an opinion based question, but I look for a better opinion that makes more sense if there is one.

Aucun commentaire:

Enregistrer un commentaire