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
Hi, I have a question about the select options update.
Since I want to update select options content after fetching data, I'm trying to implement as:
const[{ version },set]=useControls(()=>{version: {options: []}})// Set after create above controls to make folders for configs belowconstutilities=useControls('Utilities',{showStats: {value: false,label: 'Stats'}})useEffect(()=>{fetch('/api/data').then((data)=>{returndata.json();}).then((versions)=>{letversionNames=versions.data.map((version)=>{returnversion.name;});set({version: {options: versionNames}});// This emits an error.})},[])
The emited error:
Type '{ options: string[]; }' is not assignable to type 'string'.
It seems it's only for current selection option, not for updating options list itself.
Is there any ideas to solve that?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I have a question about the select options update.
Since I want to update select options content after fetching data, I'm trying to implement as:
The emited error:
It seems it's only for current selection option, not for updating options list itself.
Is there any ideas to solve that?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions