Re: How to properly append/replace DOM elements using just karax

2020-01-23 Thread NerdRat
I have solved the issue the karax way, to produce a new element and get it render, I created each element using `VNodeKind`, to make the button "create" the new element, I simply save the previously selected option `VNodeKind` and createt with `newVNode`, wrapped in `buildHtml()`:

Re: How to properly append/replace DOM elements using just karax

2020-01-17 Thread NerdRat
According to that README, my third approach should work. I mean `renderElement selector.selected` should render the new element when some event happens: > But how does Karax actually keep the DOM up to date? The trick is that every > event handler is wrapped in a helper proc that triggers a

Re: How to properly append/replace DOM elements using just karax

2020-01-17 Thread kidandcat
You have an example in the repo's Readme: [https://github.com/pragmagic/karax#event-model](https://github.com/pragmagic/karax#event-model) Basically use for

How to properly append/replace DOM elements using just karax

2020-01-16 Thread NerdRat
I am fairly new using karax. Playing with it, I tried to make elements spawn by clicking a button. The following approach works fine but it throws an exception ruining other karax components. type Selector = ref object selected: kstring ...