Closed conorwaltersUno closed 1 year ago
Hi,
I have been having some troubles implementing the setSelected method to save the selected key. All I can manage to do is save the value.
My data array looks like the following:
[{ key: "1", value: "name"}, { key: "2", value: "name2"}]
<SelectList setSelected={(key) => { console.log(key); setSelectedBoatId(key); }} data={data} save="value" defaultOption={data[0]} />
Here I want the setSelectedBoatId to take in the number held in the object key but all I seem to be able to get is the value. If anyone can help out would be greatly appreciated! 🚀
Nevermind...... was being stupid and didnt realise the save="value" controls what is being passed into the setSelected function.... 😮💨 🔫
Hi,
I have been having some troubles implementing the setSelected method to save the selected key. All I can manage to do is save the value.
My data array looks like the following:
Here I want the setSelectedBoatId to take in the number held in the object key but all I seem to be able to get is the value. If anyone can help out would be greatly appreciated! 🚀