You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that we search, we are setting new options as filteredOptions in the state, but before the next render the options are restored back to its original value. Take a look at getDerivedStateFromProps method.
// this compare only checks an array with no data, doesnt deep check, this comparison use for get api
if (options !== state.options) {
newState.options = options
}
state.options in this case will be equal to filteredOptions but options are the options array that we pass in hence the modified options that we get after search and filter are overwritten by the default filtered options.
Any idea what this chunk of the code was intended for? Is it safe to remove?
The text was updated successfully, but these errors were encountered:
I noticed that we search, we are setting new options as filteredOptions in the state, but before the next render the options are restored back to its original value. Take a look at getDerivedStateFromProps method.
state.options in this case will be equal to filteredOptions but options are the options array that we pass in hence the modified options that we get after search and filter are overwritten by the default filtered options.
Any idea what this chunk of the code was intended for? Is it safe to remove?
The text was updated successfully, but these errors were encountered: