Skip to content

v6 Warning: React does not recognize the "someProp" prop on a DOM element #4136

Answered by bcole808
giannif asked this question in Q&A
Discussion options

You must be logged in to vote

I believe transient props do need to start with $.

According to the migration steps for v6, you can restore the previous behavior by wrapping your app in <StylesheetManager> and providing an implementation for shouldForwardProp.

For example, you can do something like this to restore the behavior from v5:

import isPropValid from '@emotion/is-prop-valid';
import { StyleSheetManager } from 'styled-components';

function MyApp() {
    return (
        <StyleSheetManager shouldForwardProp={shouldForwardProp}>
            {/* other providers or your application's JSX */}
        </StyleSheetManager>
    )
}

// This implements the default behavior from styled-components v5
function shouldForwar…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@giannif
Comment options

@giannif
Comment options

@giannif
Comment options

@bcole808
Comment options

Answer selected by giannif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants