Emotion: innerRef is missing from react-emotion typings

Created on 20 Oct 2017  路  3Comments  路  Source: emotion-js/emotion

From twitter.

https://twitter.com/rossipedia/status/921138316677976064

I don't know much about TS so I need outside help on this one.

cc @cameron-martin @renatorib

Most helpful comment

innerRef allows you to get reference to inner component.

const MyEmotionComponent   = styled('div')`color:red`;
let myRef;

<MyEmotionComponent  ref={(ref) => myRef = ref} /> // myRef - MyEmotionComponent 
<MyEmotionComponent  innerRef={(ref) => myRef = ref} /> //  myRef - div element

While we're talking abut extra props for components, there is also css prop.

All 3 comments

What's innerRef?

innerRef allows you to get reference to inner component.

const MyEmotionComponent   = styled('div')`color:red`;
let myRef;

<MyEmotionComponent  ref={(ref) => myRef = ref} /> // myRef - MyEmotionComponent 
<MyEmotionComponent  innerRef={(ref) => myRef = ref} /> //  myRef - div element

While we're talking abut extra props for components, there is also css prop.

I'm doing the TypeScript definitions for them now and I'll send a PR in a sec.

While we're talking abut extra props for components, there is also css prop.

Definitions for the css prop were added here: https://github.com/emotion-js/emotion/pull/416

Was this page helpful?
0 / 5 - 0 ratings