In my project I have a call to an action that makes a webservice call and in turn dispatch actions to the result of the ws, these actions edit the store. My problem is in :
ComponentDidUpdate () {
If (this.props.messages.length) {
Const items = this.props.messages.filter (this.isDisplayable);
This.timer = setInterval (() => {
If (items.length> 0) {
This.props.popItem (items);
} Else {
ClearInterval (this.timer);
}
}, This.props.interval);
}
}
In fact it is launched several times and I have warnings of
Warning: flattenChildren (...): Encountered two children with the same key,
1
. Child keys must be unique; When two children share a key, only the first child will be used.
I used the componentDidMount but it launches it before api responds.
my question is: Is that there is a way to update the component only at the response of my action, or alternatively to pass the warnings ?