Change object in edit form
Hi everyone,
i have a endpoint
offers
in which i have a field ski_resort
. I have an other endpoint ski_resorts
which return all the ski resort available. I display the all the ski resort in edit offer form with the useSelect()
hook. I would like to change all the field ski_resort
in the obejct with with ski_resorts
endpoint response. How can I do that ?
Here is my useSelect hook
Here is an Offer
object
Here is a ski_resort
object return by the ski_resorts
endpoint
4 Replies
quickest-silver•2y ago
here is my select component
and here is my initial state
selected
:
Hey @harisris 👋 ,
Thank you for contacting us!
I'm not sure the question is exactly about Refine. Is this a general React question or is there something Refine can't do?
quickest-silver•2y ago
Hi @Omer
The
useSelect
hook allow value
props and label
props and i would like to update the value
props to an object et define the different object field within this props to send it to the API to update the ski_resort
field in offers
endpoint with the infos from the ski_resorts
endpointhmm you can access raw data with queryResult parameter of useSelect
https://refine.dev/docs/api-reference/core/hooks/useSelect/#return-values