lilactown / helix

A simple, easy to use library for React development in ClojureScript.
Eclipse Public License 2.0
627 stars 52 forks source link

todo-mvc example doesn't work with repl #94

Closed janat08 closed 2 years ago

janat08 commented 2 years ago

Im trying clojurescript's, which people say is excellent repl, and it looks like it doesn't work judging by how I can only evaluate hello world in a comment. The todo param, or filtered todos produce nill values in the app function. I decided to check in here in case I'm misusing something before dumping cljs.

lilactown commented 2 years ago

@janat08 I don't know what you're trying to do, so it's hard for me to help you. Could you give a list of ordered steps you're trying, and explain what you expect to happen and then what actually happens?

In lieu of that, I'll just say that generally helix is not very REPL friendly since it (by default) uses React hooks for state management. React hides a lot of the state from you inside of closures and its own internal book keeping, so you cannot easily view and manipulate the state of your components from a REPL.

The ClojureScript REPL shines when you're writing pure functions that take in data and return data. So for instance you ought to be able to invoke the multimethod that it uses as a state reducer with some example state and an action, and see what the new state would be, from your REPL and see the result.

If you're interesting in a framework that gives you more tools to view and manipulate the state of your running application, you could try out https://github.com/reagent-project/reagent or use an external state management library like reseda with helix.

There's a TodoMVC for reagent, which might help you get started.

Hope that helps! And again, if you'd like help with anything specific you're trying, post the steps you're doing and what you expect to happen/what is actually happening and I'll try and troubleshoot with you.

janat08 commented 2 years ago

Thanks for the write-up. They say it's the best interop with js, so I was hoping repl would be supported.