devcards
devcards copied to clipboard
Added DataScript rendering support
- Added two lines of code in core.cljs in order to add the :render-fn
parameter to e.g.
defcard-rg
- Added one function to util/utils.cljs —
ds->seq
— in order to correctly render DataScript databases via Devcards. Provided documentation for this
@bhauman ,
@Conaws (Conor White-Sullivan) reached out to you on Twitter a few weeks back (his handle there is @Conaw) and talked about possibly doing a pull request to support DataScript rendering. Here it is.
The description and documentation I provided in the pull request is pretty self-explanatory, but do let me know if you have any questions.
Thanks! Devcards is awesome!
- Alex
Hey,
Could you call this data-render-fn
and have it return the rendered react elements. (i.e. don't pass the result to edn-rend/html-edn
). This would be much more general.
Thanks!!
It seems that this PR can be replaced by just using projection:
:projection
(fn
[db]
(->> db
(map (fn [d] {:e (:e d)
:a (:a d)
:v (:v d)
:tx (:tx d)
:added (:added d)}))))
Would we be able to either close this or to start a library of functions that work as projections? I didn't see a bunch of documentation on projection other than a simple example. Either way, I'm up for giving this a go.
I think starting a library of projections makes a lot of sense.