Is it okay to assign the value of the DetailsList's setkey property to a static string?

189 Views Asked by At

I am using Fluent UI DetailsList component.

I have a custom parent component that has a DetailsList component as a child component. This parent component is used in many places, and the items props passed to the DetailsList component are many and varied.

When using this parent component, I want to use the DetailsList's setkey property to retain the selection information even if an unexpected re-render occurs.

Even if this parent component is used in many places, would it be better to set the property value of setkey to a consistent string value?

Or is it more effective to reduce unexpected bugs or side-effects by using the setkey property value that combines the unique information of the delivered items props?

Also, is there another way other than using the setkey property value to maintain the selection information of the DetailsList?

1

There are 1 best solutions below

0
Spencer Wood On

They do this themselves in several documentation pages so I would say it's fine.