React + Antd + SpringBoot front-end and back-end development, the front-end problems Each child in a list should have a unique “key” prop.

For Each child in a list should have a unique “key” prop. This problem often occurs on the front end, because Dom needs a key when rendering the array . If the Key values ​​​​are inconsistent, the above-mentioned problems will appear in the console

solution:

When writing the background under the Springboot framework, you need to pass a Key value to the front end. When using the <Table /> component in Antd, you can use this key value to solve the problem

<Table columns={columns} dataSource={this.props.data} rowKey={columns => columns.key} />

The Key here in columns.key is based on the value passed in your background, and you can set any name for it.

The value obtained by using the PostMan test interface in the background, the Key here corresponds to the above key

Guess you like

Origin blog.csdn.net/weixin_51220967/article/details/124524967