Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type 'Provider<AnyAction>' is missing

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 ?

like image 694
Byeongin Yoon Avatar asked Jan 27 '23 09:01

Byeongin Yoon


1 Answers

OMG

my file name was index.ts

I changed it to index.tsx

Now works well.

like image 173
Byeongin Yoon Avatar answered Feb 04 '23 05:02

Byeongin Yoon