Where is props coming from in the second to last example? Is it something that is transpiled in?
We passed the props a code example above, when we did something like this:
<DivWrapper color= 'blue' > </DivWrapper>
When you pass a prop to DivWrapper, <DivWrapper color='blue'>...</DivWrapper>
DivWrapper
<DivWrapper color='blue'>...</DivWrapper>
styled will pass the prop and make it available auto"magically".
styled
const DivWrapper = styled.div` width: 50%; border: 2px solid black; ${props => (props.color === 'blue') ? `background-color: blue`: null} ${props => (props.color === 'red' ? `background-color: red`: null)} `;
And @ogwurujohnson , Shouldn't the color prop passed as my example above instead of like <DivWrapper color: 'blue'>?
<DivWrapper color: 'blue'>
Yeah, you are right. Lol was a typo. Would correct that immediately.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Where is props coming from in the second to last example? Is it something that is transpiled in?
We passed the props a code example above, when we did something like this:
When you pass a prop to
DivWrapper
,<DivWrapper color='blue'>...</DivWrapper>
styled
will pass the prop and make it available auto"magically".And @ogwurujohnson , Shouldn't the color prop passed as my example above instead of like
<DivWrapper color: 'blue'>
?Yeah, you are right. Lol was a typo. Would correct that immediately.