Bom dia, estou recebendo o warningao me inscrever com subscribe.
Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
Qual a razão dele e como resolve-lo?
Código:
export default class Usuarios extends Component {
constructor(props) {
super(props);
this.state = {usuarios : []}
}
componentWillMount() {
this.props.store.subscribe(() => {
this.setState({usuarios: this.props.store.getState()});
})
}
componentDidMount() {
UsuarioApi.listar(this.props.store)
}
...
}