bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 113 forks source link

Add support for reagent #12

Closed allgress closed 10 years ago

allgress commented 10 years ago

Sorry about the whitespace changes. This adds support for the reagent ClojureScript wrapper around React (https://github.com/holmsand/reagent). I added a separate set of examples, as there are multiple ways to create a React component via reagent.

bhauman commented 10 years ago

Hey thanks for this. I have looked at it a bit and I am a little concerned. In the local state example the state will get blown away on every code change, which is not what I'm going for.

Also, defining global atoms that are referenced within the templates require that all the templates share state.

It's actually hard to get isolated running reagent examples and render them in different states, where the states persist across code reloads. Which IMHO is counter to what we are going for here.

There is a solution but I'm going to reflect on this a bit ..

Your pull request is super helpful in that it has provided me with a good place to start thinking about this, thanks.

allgress commented 10 years ago

I see what you mean. We get around this by using Datascript in conjunction with reagent. It's a good combination to address this type of issue, but rolling both into devcards feels a little heavy-handed. I'll just make a separate card lib with some examples.