How can pass ref property to component in emotion js?

610 Views Asked by At

I'm using emotionJs for styled component in my project , I want to pass ref property to my emotion styled component , how can I do that?

import styled from '@emotion/styled';
const Page = styled.section<PaperProps>(({ theme, color = 'paper' }) => ({
  backgroundColor: color && theme.palette.background[color],
  color: theme.palette.background.contrastText,
  padding: theme.spacing(2),
  borderRadius: theme.radius.default,
}));

export default Page;

when I get my ref variable it returns null :

const myRef = createRef();
<Page ref={myRef}> 
....
</Page>
0

There are 0 best solutions below