I am learning react and I started by using styled-components
and react-router dom
But I face difficulties apply my custom styled component to an existing component not created by me.
Here is the code:
import React from "react";
import { NavLink } from "react-router-dom";
import styled from "styled-components";
const NavStyle = styled.div`
color: red;
margin: 10px;
`;
const Navigation = () => {
return (
<div>
<NavStyle>
<NavLink to="/">Home</NavLink>
</NavStyle>
<NavLink to="/about">About</NavLink>
<NavLink to="/contact">Contact</NavLink>
</div>
);
};
export default Navigation;
The problem is that color: red
is not applied, but margin: 10px
is applied in the view. Why so?