Can we pass props to a component that has the same name and value implicitly?
Example:
Let\'s say that I have a variable called x: const x = 1
Booleans can be passed implicitly to the component as @Ajay also pointed out in comments, like
which is basically equivalent to
However, if your variable is something other than a boolean, than you need to write it like
Or if you have a number of such props, you can form an object like
const cmpProps = {
x,
y,
foo,
bar
}
and pass them using Spread attributes like