getDerivedStateFromProps
...
static getDerivedStateFromProps(props, state) {
console.log(props)
console.log(state)
return {
filteredNews: props.data,
}
}
// удалите componentWillReceiveProps
...

Last updated
...
static getDerivedStateFromProps(props, state) {
console.log(props)
console.log(state)
return {
filteredNews: props.data,
}
}
// удалите componentWillReceiveProps
...

Last updated
static getDerivedStateFromProps(props, state) {
let nextFilteredNews = [...props.data] // было nextProps - переименовали
nextFilteredNews.forEach((item, index) => {
if (item.bigText.toLowerCase().indexOf('pubg') !== -1) {
item.bigText = 'СПАМ'
}
})
return { // возвращаем новое состояние
filteredNews: nextFilteredNews,
}
}