In my React child component I have access to a variable options
which returns an array of objects.
In this component I have a function which checks if there are options:
const hasOptions = () => options.length > 0;
console.log(hasOptions());
This returns true
or false
.
In my parent component I need this boolean value to conditionally add some styling (based on the boolean value).
How do I pass this boolean value from my child to parent component?