I came across a peculiar problem in my react application. The change handler of an input field was not passing the event object, rather only the value of the field was getting passed. I'm using rsuite and I think it uses Semantic-UI components somewhere, not sure, need to check more on this. Long story short, I fixed it by using the second argument of the handler function, didn’t know that existed.
//old version
const handleChange=(event)=>{
console(event.target) // undefined
console(event) // value of the object which should otherwise be event.target.value
}
//new version
const handleChange=(value, event)=>{
...
}
Also, I'm changing the challenge name to 30 days of Code. It looks rather achievable :P
Top comments (0)