S
S
shading2019-12-17 14:29:29
React
shading, 2019-12-17 14:29:29

How to refer to the state of the editor from App.js?

I want to make a check in App.js, if the isLogged state in the reducer == false, then display the authorization window, otherwise something else

{ store.auth.state.isLogged
                    ? <AuthContainer/>
                    : null
                }

How to access auth.state.isLogged from App.js and is it correct to do so at all?
Git link - https://github.com/Shading29/tosterr

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Minimal, 2019-12-17
@shading

Initialize the store in index.js and wrap the App in a provider and you will have access to the store from the App

ReactDOM.render( <Provider store={store}><App /></Provider> , document.getElementById('root'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question