Send Select without a form with GET method not working... React #1774
Answered
by
alexthekiwi
vitalijalbu
asked this question in
Help (React)
-
Hi guys, basically I need a order-by select filter for my data, problem is that state form changes correctly but is sends JS:
CONTROLLER:
|
Beta Was this translation helpful? Give feedback.
Answered by
alexthekiwi
Jan 22, 2024
Replies: 1 comment 1 reply
-
I think it's just an issue with how you're using the React state. When you call handleSubmit within the handle change function, it's still using the previous value of data, because React hasn't re-rendered the component. To resolve, you'd either need to use a useEffect watching the value of data, or use router.get within the handleChange function. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
derrickreimer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think it's just an issue with how you're using the React state. When you call handleSubmit within the handle change function, it's still using the previous value of data, because React hasn't re-rendered the component.
To resolve, you'd either need to use a useEffect watching the value of data, or use router.get within the handleChange function.