C
C
chelkaz2018-11-16 10:38:20
React
chelkaz, 2018-11-16 10:38:20

Warning: Encountered two children Why does it render as duplicates?

In one component, after loading, checkboxes appear, clicking on which sections with pagination are shown. Storage goes through

this.state = {
            products_data: []
        }

And then when we look at the following pages, we do a concatenation:
this.products_data = this.products_data.concat(this.props.products.item.data);

In general, section output and pagination work fine.
But then when you click on a specific section, information about it is loaded in the store, and another component is rendered, with a detailed view, and hides with categories. But at this moment the console is clogged with warnings:
Warning: Encountered two children with the same key, `506685`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.

I look, and when I open the detailed view, a component with categories is also rendered. And he starts duplicating them.
What is the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question