I have a component which is currently taking in a object value as a prop which is being spread.
const primaryProps = {/* about 10 key/values in here */}
<Component
{...primaryProps}
/>
This works as intended. But now I am try to add an OR
to it and add another object which is spread. But this is throwing syntax errors. Is there a way around it? Thanks.
Tried following which doesn’t work.
const primaryProps = {/* about 10 key/values in here. Can also be empty/null */}
const secondaryProps = {/* about 10 key/values in here */}
<Component
{...primaryProps || ...secondaryProps}
/>
<Component
`${primaryProps.join(",") || secondaryProps.join(",")}`
/>