You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type of the children prop in FlagsmithContextType doesn't align with the type normally used for children props which results in having to wrap an actual children prop used inside a FlagsmithProvider with a fragment to make it work without TS errors. Perhaps the type could be changed from ReactElement | ReactElement[] to simply ReactNode, which would be the same as the PropsWithChildren generic type provided by React.
// Example of errortypeFeatureFlagProviderType={serverState: IState;};exportconstFeatureFlagProvider=({
serverState,
children,// ReactNode}: PropsWithChildren<FeatureFlagProviderType>)=>{constflagsmithInstance=useRef(createFlagsmithInstance());return(<FlagsmithProviderflagsmith={flagsmithInstance.current}serverState={serverState}>{children}</FlagsmithProvider>);};
However, by wrapping children with a fragment or something else, there are no issues.
Perhaps I'm missing something, but is there any special reasoning behind using ReactElement | ReactElement[] for children?
The text was updated successfully, but these errors were encountered:
The type of the children prop in
FlagsmithContextType
doesn't align with the type normally used for children props which results in having to wrap an actual children prop used inside a FlagsmithProvider with a fragment to make it work without TS errors. Perhaps the type could be changed fromReactElement | ReactElement[]
to simplyReactNode
, which would be the same as thePropsWithChildren
generic type provided by React.However, by wrapping children with a fragment or something else, there are no issues.
Perhaps I'm missing something, but is there any special reasoning behind using
ReactElement | ReactElement[]
for children?The text was updated successfully, but these errors were encountered: