Skip to content

React 18 Support #156

Closed
Closed
@elliotwestlake

Description

@elliotwestlake

We're currently upgrading to React 18 but getting this type error:

error TS2322: Type '{ children: Element; optimizely: ReactSDKClient; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<OptimizelyProvider> & Readonly<OptimizelyProviderProps>'.
  Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<OptimizelyProvider> & Readonly<OptimizelyProviderProps>'.

108     <OptimizelyProvider optimizely={optimizelyClientInstance}>

Would be nice for the repo to be updated to React 18, however, I see that's going to require a fair amount of work as you guys are using enzyme which doesn't look like it's going to support React 18 ever. So may need to migrate to RTL.

The simplest solution I can see now is to explicitly define a children prop to satisfy React 18.

https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-typescript-definitions

Be great to hear your thoughts.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions