Fork me on GitHub

in organizing a reagent project, I typically have state.cljs, util.cljs, components/<components>… where should I put things that change state?


I know this is a matter of taste, but just about any of your suggestions will be better than my guess.




I’ve seen fn.cljs and mutations.cljs in a single project, but am not clear on what the difference might be.

👍 3
Franco Gasperino02:04:40

i'm a complete neophyte, but i used dispatch.cljs

Franco Gasperino02:04:27

as functions defined in that ns are the link between the larger app and re-frame


gotcha… not using re-frame yet, but will soon.


that’s helpful.

Grigory Shepelev09:04:58

I need a little help with a task. The project that my boss wants to make is a small SPA for his service. He wants it to be on clojurescript with theme he paid for. I took that theme and separated all the React components from it and published them as a separate npm package into my private GH repo. But for some reason when I'm trying to use it with shadow-cljs and reagent I am having errors of them not being a React components although the surely do (if being printed to browsers's console) look like react components. I guess that's the "exact" part of my question. The more broad part is: I'm quite sure that adapting existing React components written with js into your cljs project is a common task. How is it better to be done?

Grigory Shepelev09:04:03

All the resources that I've found online while digging into that problem didn't gave me quite and answer.


Two questions: - Why did you create a separate NPM package from it? IMO it would be much simpler to just ship the JS sources along with the CLJS sources - Do you have a minimal reproducible example with that error?

Grigory Shepelev12:04:55

Sorry for such a late reply. 1. I've decided to separate views and logic as much as possuble IMO it's a bad practice to mix languages and technologies directly in the project's file system. I wanted to add more "cool stuff" like Storybook to that theme and make it possible to use same react components by other company's projects. 2. Not for now.