I am setting a component that receive a specific prop. This prop is the resulting object of a find method on the parent component. The state would be the controller of an input on a form.
When the find method does not find anything, it returns an undefined. I defined my state this way:
const [foo, setFoo] = useState(props.bar? props.bar._id : "");
This works great, but I'm wondering if it's correct to do it like that.