Add support for directly use other react component
In reagent, we can just directly use react component by
[:> SomeComponent {} ...]
while sablono seems not support this. Now I need to write wrapper functions which made the syntax not looked so concise compared with just using vector.
How about it?
Hi @dum3ng,
this has been asked a couple of times before. I'm not keen on extending the Sablono/Hiccup language with something like this at the moment, since it adds a lot more complexity. My main concern with something like this is server side rendering.
For now, I would suggest to wrap this in a function if you use this a lot.
We can revisit this later.
Just discussed this over at the Rum issue tracker :)
https://github.com/tonsky/rum/issues/183
Would be really nice to be able to refer to a React component class in place of a symbol. Something like [js/MyReactComponent {} ...], just as simple as [:div {} ...].
Currently, you have to do something like this:
(js/React.createElement js/MyComponent
#js { }
(sablono.core/html [:div [:p "Hello, world"]]))
Which is a whole lot more cumbersome.
I can try to write up a PR if you would consider something like that!
Hi @augustl ,
I didn't add this yet, because of server side rendering. How would that work? The only solution I had in mind so far is emitting a blank div or something like that.
Give it a try, but please keep the server side rendering in mind. Server side rendering is done via om.next at the moment, but since not much is happening with om.next I thought about borrowing that code and remove that dependency (which causes some problems already).
r0man