0
Hi, my question is if I can access store variables in functions, something like:
--usuarioReducer.js--
const initialState = {
usuario: {},
isAuth: false
}
--root.js--
import { Redirect } from 'react-router-dom';
export default class App extends Component {
componentDidMount() {
if(!**variavel_is_auth_store**) { // Se isAuth === false, redireciona para Login
return <Redirect to={'/Login'} />
}
}
}
I wonder if it is possible to take that variable of Reducer that is in the Store and use it in functions
has yes, that’s what it’s for.
– novic
Yeah, but how to do it?
– Ban
your minimum code needs to update all code related to Redux ... only it becomes difficult to respond
– novic
a good study link: https://medium.com/reactbrasil/initiator-redux-c14ca7b7dcf
– novic