ref.current.clearValue() triggering reducer action #5650
-
Hi all, I have been learning react (and next.js) for the past 3 months or so. I am currently building an e-commerce site which uses react-select and useReducer() for sorting and filtering of products ( price :low to high, price : high to low etc). I am referencing react-select with ref so that the user can reset it . I am attaching a sample representative code below: reducer function :
app.js :
In the above sample code , when selectRef.current.clearValue() is triggered, it also triggers a reducer action of type("any action"). In the actual code, I am passing value.value ,
In this case Is this behavior normal? Or there's an issue is my code? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When react-select is reset, onChange() is triggered with a null value which causes the undefined action. |
Beta Was this translation helpful? Give feedback.
When react-select is reset, onChange() is triggered with a null value which causes the undefined action.