rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript | 0.12.8 https://github.com/tonsky/rum/blob/gh-pages/CHANGELOG.md#0128
Aron 2020-05-15T06:27:11.093900Z

neovim is an ide?

2020-05-15T07:10:03.094400Z

What's the idiomatic way to have a child component return something for the parent component to use?

2020-05-15T07:21:35.095100Z

Depends on what you are trying to achieve

2020-05-15T07:23:48.096400Z

If it's something other than hiccup/UI, then normally you'd pass a callback into the child component

2020-05-15T07:27:25.096800Z

Like say I want acces to the value of a textarea from the parent?

2020-05-15T07:28:29.097400Z

But assume I don't want to just use innerHTML on the element

2020-05-15T07:29:05.098Z

Keep the state in the parent and pass it down to text area

2020-05-15T07:30:43.098600Z

Hum... like pass an atom in for the child to swap! ?

2020-05-15T07:32:13.100600Z

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.

2020-05-15T07:32:37.101500Z

Pass the value and a callback that takes a new value and updates the state

2020-05-15T07:32:51.102100Z

That's a common practice in React

2020-05-15T07:33:52.103Z

I see, for that you can assign a listener onto code mirror instance and call the callback there

2020-05-15T07:34:49.104300Z

My knowledge of react and js is very minimal, what is a listener?

2020-05-15T07:35:54.106Z

That should be a part of codemirror API, I don't know exactly, just an event handler that is called on every change

2020-05-15T07:37:46.109Z

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

2020-05-15T07:38:40.110100Z

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 ?

2020-05-15T07:39:34.111100Z

lifecycle mixins take rum state where you can lookup args

2020-05-15T07:39:56.111800Z

Also if you are using latest rum, same can be done a bit easier with hooks

2020-05-15T07:40:19.112300Z

Oh, with :rum/args ? on the state?

2020-05-15T07:40:40.112900Z

Yep

1👍
2020-05-15T07:40:47.113200Z

I am using latest rum, I didn't fully understand hooks yet so haven't tried them out

2020-05-15T07:42:52.114900Z

Is it possible to do all things with hooks that the mixin callback let you do?

2020-05-15T07:43:57.115100Z

Yes, it is

2020-05-15T07:44:51.115900Z

Hum, interesting, maybe I'll spend a bit more time reading about them and trying to understand how to use them in rum

2020-05-15T07:45:49.116500Z

Thanks