neovim is an ide?
What's the idiomatic way to have a child component return something for the parent component to use?
Depends on what you are trying to achieve
If it's something other than hiccup/UI, then normally you'd pass a callback into the child component
Like say I want acces to the value of a textarea from the parent?
But assume I don't want to just use innerHTML on the element
Keep the state in the parent and pass it down to text area
Hum... like pass an atom in for the child to swap! ?
That's what I had right now, though I guess things are a bit ugly. Because I'm trying to access the code mirror value, where code mirror is created in the did-mount function. And the state on defcs of the render function runs before did-mount.
Pass the value and a callback that takes a new value and updates the state
That's a common practice in React
I see, for that you can assign a listener onto code mirror instance and call the callback there
My knowledge of react and js is very minimal, what is a listener?
That should be a part of codemirror API, I don't know exactly, just an event handler that is called on every change
Ah ya, there is a change event handler. I guess I thought since I only care to grab the value when someone clicks a button. And my parent component is basically a combination of codemirror + button. My thought was to have in the on-click of button just grab the value. So I thought surely I can somehow return the codemirror instance to the parent so I can use it in the button on-click
But say I did use the on-change event for code mirror. I'm still confused how I'm supposed to pass the callback into the did-mount ?
lifecycle mixins take rum state where you can lookup args
Also if you are using latest rum, same can be done a bit easier with hooks
Oh, with :rum/args ? on the state?
Yep
I am using latest rum, I didn't fully understand hooks yet so haven't tried them out
Is it possible to do all things with hooks that the mixin callback let you do?
Yes, it is
Hum, interesting, maybe I'll spend a bit more time reading about them and trying to understand how to use them in rum
Thanks