reactjs - Tipo 'Provider' falta
Estoy haciendo un proyecto de React con TypeScript.
Este es mi código en index.ts
const store = configureStore(initialStateFromDB);
ReactDOM.render(
<Provider store={store}>
<App></App>
</Provider>,
document.getElementById('app')
);
¡Y tuve tantos errores!
primero.
Type 'Provider<AnyAction>' is missing the following properties from type 'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>[]': length, pop, push, concat, and 25 more.ts(2345)
segunda
Conversion of type 'Store<{}, AnyAction> & { dispatch: {}; }' to type 'Provider<AnyAction>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.ts(2352)
No puedo entender lo que significan estos mensajes de error.
¿Qué debo hacer para solucionar este error?
Respuesta #1
Dios mío
mi nombre de archivo era index.ts
Lo cambié a index.tsx
Ahora funciona bien.