Using styled-components, if you have Title
defined in an imported file:
//comp.js
const Title = styled.h1`
color: red;
`;
Is it possible to use Title
without having to define Title
in the index.js? For example,
//index.js
import "./components.js";
render(
<Title>Text here</Title>,
document.getElementById("root")
);
I'm not sure if this is possible, and haven't found a way to do it and I may be out of my depth in thinking of a solution. In this example, Title
would be re-used many times so, if I have pre-defined set of multiple components, I kind of want to avoid having to define every component (Title, Button, Field, etc) in index.js
since it's already being defined somewhere else.
Hope this makes sense.
Thanks!