masakudamatsu / line-height-picker

A front-end web app that helps web designers/developers pick the best line-height value for their websites
https://line-height-picker.vercel.app
MIT License
2 stars 1 forks source link

Fix PropTypes errors in the console #212

Closed masakudamatsu closed 4 years ago

masakudamatsu commented 4 years ago

The initial value of the most props is '', to use sessionStorage (which allows string values only).

For number props, this causes a PropTypes error.

The solution is to allow '' as one of the expected types:

PropTypes.oneOfType([
  PropTypes.number, 
  PropTypes.oneOf([''])
]),

(The same for boolean props.)

masakudamatsu commented 4 years ago

We change back the PropTypes of the boolean state variable props (cssButtonDisabled, previewButtonDisabled, nextButtonDisabled) to string. As we use the string-only sessionStorage to keep the state variables, we should avoid using boolean.