[Table] Demo for table should derive the sorted data #11827
Labels
component: table
This is the name of the generic UI component, not the React module!
docs
Improvements or additions to the documentation
new feature
New feature or request
Expected Behavior
The Table "Sorting & Selecting" component demo should make it easy to follow React best practices. So, if I quickly change
data
forthis.props.data
, it should just work:Current Behavior
Used as is, the
EnhancedTable
component will not rerender whenprops
change. The React documentation warns against copying props into the state (see here). Yet with this example it is very easy to replace the static data withprops.data
and expect it to work as is.Steps to Reproduce (for bugs)
I'd be happy to provide steps to reproduce, not sure that's necessary here since there's a better pattern for the example that is fairly easy to implement.
The problem can be found in the
EnhancedTable
constructor:I think the example would be simpler and more correct if the sorted data was computed when rendering. I will be providing a PR with a potential solution.
The text was updated successfully, but these errors were encountered: