so, I updated https://github.com/ashnur/sierpinski-cljs-fiber-demo it follows the https://github.com/facebook/react/tree/master/fixtures/fiber-triangle quite closely, simpler at places. the scaling animation applied to the whole app https://github.com/ashnur/sierpinski-cljs-fiber-demo/blob/master/src/sierpinski/experimental.cljs#L75 through its props stops until https://github.com/ashnur/sierpinski-cljs-fiber-demo/blob/master/src/sierpinski/experimental.cljs#L42(`second` ) is updated. I tried to defer and everything, but nothing helps. Could be react bug, but I would suspect bug in my code first
can't even type properly, but I added links with the edits to what I am talking about
tbh, the performance is good enough for most real world applications, if it wouldn't be the point of the whole exercise to not get blocked animation, I wouldn't care : )
Are there any examples of using helix and shadow-cljs to grab and use a 3rd-party hook from npm?
should just work if you require it, no?
which hook is this?
Yeah in my experience, 3rd party hooks just work out of the box with helix and shadow-cljs
useMachine from @xstate/react
@laheadle the only complexity here is understanding how to represent JavaScript objects using ClojureScript syntax
for instance, to use their example on the quick-start of their docs:
import { useMachine } from '@xstate/react';
import { Machine } from 'xstate';
const toggleMachine = Machine({
id: 'toggle',
initial: 'inactive',
states: {
inactive: {
on: { TOGGLE: 'active' }
},
active: {
on: { TOGGLE: 'inactive' }
}
}
});
would translate to:
(ns my-app.feature
(:require
["xstate" :refer [Machine]]
["@xstate/react" :refer [useMachine]]))
(def toggle-machine
(Machine
#js {:id "toggle"
:initial "inactive"
:states #js {"inactive" #js {:on #js {"TOGGLE" "active"}}
"active" #js {:on #js {"TOGGLE" "inactive"}}}}))
these differences are extremely mechanical, and it’s a matter of learning how to use ClojureScript; helix doesn’t introduce any new rules
if you’re new to CLJS, feel free to post here or in #clojurescript when you get stuck and I’ll do my best to help out 🙂