how do people inspect state?
people? what do you mean inspect?
people, as in human beings : D inspect means the word inspect
https://clojureverse.org/t/introducing-shadow-cljs-inspect/5012 like the word used here
or here https://i.imgur.com/PkVg33H.png
@ashnur Personally I simply use the repl to inspect any data. I tried shadow-cljs inspect and tbh, it doesn't feel that easy to use (or maybe I didn't get how to use it correctly).
simply?
so not easily?
: )
how do you use the repl exactly to see the live data in helix hooks?
I can evaluate stuff from my editor and print into browser console, very neat trick, but it doesn't help me get access to the state
React dev tools , log the component to the console
Then you get the custom formatters in play
In theory you could also inspect the values directly in dev tools but they don’t speak CLJS
We've been discussing the devtools internally. If we get some breathing room, I'd love to have one of our devs add JSONML support to the react devtools.
Although - we're pretty small, so it might be better for us to sponsor someone to look at that.
There was some discussion about this with the react team, the rationale being that they need to also support immutable.js and immer so some kind of custom formatting is needed. I don’t think that went anywhere though.
I read the issues, yeah :)
I’m currently trying to gett some time to work on some code for inspecting/manipulating components at a REPL
example, imagine:
(-> (query-component MyComponent)
(inspect))
;; => {:type MyComponent
;; :props {:foo "bar" :baz {:asdf "jkl"}}
;; :state [{:count 3}]}
I saw the PR, I think that's great too
I think different tools for different times though.
Sometimes, clicky clicky is pretty handy
v true. I just think that we’ve (or at least, I have) trained ourselves to eschew the REPL for UI programming due to lack of capability
lots of people I’ve worked with just use console.log. and say how much they miss effectively using chrome’s debugger w/ their code
I think what I'd want from the repl tool is a clicky for the element somehow. So I don't need to filter a list. But maybe that's a separate tool.
@lilactown may I ask which editor/repl setup are you using?
conjure looking really good, but I have literally no idea how to make use of it
I use Emacs w/ CIDER
thanks
specifically spacemacs
used to use spacemacs too, when I was writing lots of php
but because of javascript, I stopped using it
yeah the javascript support is so-so
I think if I was doing JS for a living I would probably switch back to VS Code
but now that I only dabble in JS/TS it works pretty well for that too
vscode is for TS, not js
with new tools, the more I think about the more sure I am that spacemacs could work better. To be honest, the last straw was really something I lost on the long run, I wrote comma first at the time (this was before code formatters)
https://clojurians.slack.com/archives/CRRJBCX7S/p1591199261128000 would this work with hooks?
yeah the hooks state is stored on each fiber similar to class component state
thanks, good to know
I read those fiber docs long time ago, but I forgot the details 😐
there isn’t a public API for this so a lot of the stuff I’ve tried so far is just looking at what’s in the object after injecting some code similar to the way react devtools does it
it’s all hacky and using private APIs that might break later
yeah, not very easy, but I read some of the fiber source code and it's quite readable
i just don't remember it 😄