# Спам-фильтр

Мне осталось осветить момент обновления данных. Ранее обработка происходила в `componentWillReceiveProps`, а сейчас в `getDervidedStateFromProps` (еще и static).

Для этого мне пришлось выдумать задачу, которая на самом деле решается в момент валидации новости на бэкэнде. Но представим, что наш бэкэндер очень занят, а менеджер говорит - пожалуйста, сделай как-нибудь, потом доделаем (ага!).

Задача: если пользователь, в добавленной новости в bigText ввел 'pubg' - будем помечать такую новость как СПАМ (то есть, в bigText вырезаем все, и вставляем строку "СПАМ").

Выглядит следующим образом:

![spam filter](/files/-LvLnSqe6vcs8Ib-N6_u)

p.s. я не против pubg :) просто соблюдайте баланс между отдыхом и развитием.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://max-frontend.gitbook.io/react-course-ru-v2/spam-filtr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
