Hi Andrew, you did a great job! I found points in your code that you can improve.
- I recommend using the useEffect hook instead of using a conditional operator in your FormInput component. For example instead of this:
if (clear) {
inputRef.current.value = null;
}
Use this:
useEffect(() => {
if (clear) {
inputRef.current.value = null;
}
}, [clear, inputRef])
- The date validations do not work as they should. I recommend performing the validations with the Date object.
- You can improve the readability of your code by creating a custom hook for each context of your application and then using it. For example:
import { useContext } from 'react'
import { UserContext } from '../App'
export const useUserContext = () => {
const state = useContext(UserContext);
return {
...state
}
}
Marked as helpful
0
Andrew Eubanks• 140
@dangero1990
Posted
@RafaelSS427 thank you for your feedback. The custom hook makes a whole lot of sense, and I'm going to play around with your suggestions when I have some free time.
0