< Back to list

React

JS

Assign To Ref

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-547327595

(ref.current as React.MutableRefObject<T> ).current = element;
Compose Provider
const ComposeProvider = ({ providers, children }) => {
  return providers.reverse().reduce((acc, Val) => <Val>{acc}</Val>, children)
}
() => (
<ComposeProvider providers={[AuthProvider, ...]}>
  <Root />
</ComposeProvider>
)