Closed playfulThinking closed 2 years ago
Well this is embarrassing. I misread the Reactjs documents and thought useContext was shaped like useState, with an updater function as part of the return. It is not - you have to include an updater function in the state yourself.
Whoopsie!
Sorry for the late reply and thanks for confirming the solution @fremontmj. Yes, Fable.React are meant to be a more or less direct binding to React API so (unless there's a bug in the bindings) it should behave in the same way as React API... with all the quirks this entails ;)
@alfonsogarciacaro Late reply? LOL I just find it amazing that you have time for your great work, which is amazing, AND writing to random bozo newbie developers who can't read documentation (especially embarrassing b/c the React Hooks documentation is just amazingly good!)
Best regards and huge thanks,
Mike
I'm using
useContext
to share state among components. I can't for the life of me see how to update the state, asuseContext
only returns the state, but not an updater function, as React does. I know thatuseState
returns objects withcurrent
andupdate
functions, butuseContext
does not.What am I missing?
Thanks much!