I'm using @emotion/react
to theming and injected theme into it, I'm able to access theme using useTheme
into component but not able to access theme into styles using @emotion/styled
. Any help please?
//libs
import React from 'react';
import styled from '@emotion/styled';
import StylesProvider from '@mui/styles/StylesProvider';
import { ThemeProvider } from '@emotion/react';
const THEME = {
primary: 'red'
}
const StyledText = styled('p')`
color: ${({ theme }) => theme.primary};
`;
function App() {
return (
<StylesProvider injectFirst>
<ThemeProvider theme={THEME}>
<StyledText>test</StyledText>
</ThemeProvider>
</StylesProvider>
);
}
export default App;
here is sample code