Closed proghax333 closed 10 months ago
React
Table Colorizer
React Table Colorizer app does not warn/alert on entering an invalid number (0).
An alert should be created, showing the message: Enter a valid number.
Enter a valid number.
https://github.com/sadanandpai/frontend-mini-challenges/blob/f274042ee9e18f500017c6929cb789fdae4f777c/react/src/machine-coding/table-colorizer/TableColorizer.jsx#L14
Replace parseInt(colRef.current.value) < 0 with parseInt(colRef.current.value) < 1.
parseInt(colRef.current.value) < 0
parseInt(colRef.current.value) < 1
Already fixed it on my fork, waiting for approval to create a pull request.
You may show the text in red color below the input field instead of creating an alert. And yes you can open the PR for it. Also you may mention the valid range in your error message.
Framework/code-stack
React
Scope
Table Colorizer
Description
React Table Colorizer app does not warn/alert on entering an invalid number (0).
Expected behaviour
An alert should be created, showing the message:
Enter a valid number.
Suggested Solutions
https://github.com/sadanandpai/frontend-mini-challenges/blob/f274042ee9e18f500017c6929cb789fdae4f777c/react/src/machine-coding/table-colorizer/TableColorizer.jsx#L14
Replace
parseInt(colRef.current.value) < 0
withparseInt(colRef.current.value) < 1
.Additional Context
Already fixed it on my fork, waiting for approval to create a pull request.