Like the subject,
how to access global state inside a stefaull class component?
i can't use useState because:
Hooks can only be called inside the body of a function component.
I think the options are either:
react-redux (https://github.com/ctrlplusb/easy-peasy#alternative-usage-via-react-redux)Yep @sibartlett is right. You can use react-redux with this lib.
hi
I want use with react-redux
so It's like code is it right?
import { StoreProvider, createStore } from 'easy-peasy';
import { Provider } from 'react-redux'; // 馃憟 import the provider
import model from './model'
const store = createStore(model);
const App = () => (
<StoreProvider store={store}> // 馃憟 StoreProvider
<Provider store={store}> // 馃憟 Provider
<TodoList />
</Provider>
</StoreProvider>
)
You are correct @hanquf1
@hanquf1 How we can dispatch easy-peasy actions??
Most helpful comment
hi
I want use with react-redux
so It's like code is it right?