emotion: Don't pass innerRef to DOM component

I have a StyledInput and use innerRef to get the input element. But React will display this annoying warning.

Warning: Unknown prop innerRef on <input> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop

We should remove the innerRef after pass it to ref. Or better, filter unknown props like styled-component, but this comes with a cost of bigger runtime

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

React removes this list with React 16 as far as I know and will start passing any props to the elements without filtering.

@tkh44 - not sure if this is the same issue or belongs in a separate issue, but I still have the Unknown prop ... on tag error when using styled and any non-DOM attribute.

Small example:

const SvgWrapper = styled.div`
  width: ${props => props.iconWidth || 'auto'}
`

This results in Unknown prop 'iconWidth' on <div> tag.