I'm doing react project with typescript.
This is my code in index.ts
const store = configureStore(initialStateFromDB);
ReactDOM.render(
<Provider store={store}>
<App></App>
</Provider>,
document.getElementById('app')
);
And I got so many error!
first.
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)
second
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)
I cannot understand what these error messages mean.
What should I do to fix this error ?
OMG
my file name was index.ts
I changed it to index.tsx
Now works well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With