So I create this button with styled-components and it is a react-scroll link
import { Link } from 'react-scroll';
export const Button = styled(Link)`
border-radius: 50px;
background: ${({ primary }) => (primary ? 'red' : 'blue')};
`;
So on my Hero section, these props work fine
<Button
to="signup"
smooth={true}
duration={500}
spy={true}
exact="true"
offset={-80}
primary="true"
dark="true"
>
Sign Up
</Button>;
But in my other section I use an object with data to get the values and for some reason, they are not applying the primary
const Main = ({ primary, dark }) => {
return (
<Button
to="home"
dark={dark ? 'true' : 'false'}
primary={primary ? 'true' : 'false'}
>
{buttonLabel}
</Button>
);
};
Then in my data.js file for the main section I pass in this value
export const dataOne = {
primary: false,
dark: true,
};
export const dataTne = {
primary: true,
dark: false,
};
So if I console.log primary, it will just say false for both.
I updated my button element to the color orange if primary is true and that changes all my buttons to orange, but it doesn't make any sense why my data.js file isn't able to transfer my data over for the background color.
The only way it work for me to get data to pass through is if I create a styled component inside of the main section instead of having it outside?