Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for directly use other react component #191

Open
dum3ng opened this issue Mar 31, 2018 · 3 comments
Open

Add support for directly use other react component #191

dum3ng opened this issue Mar 31, 2018 · 3 comments

Comments

@dum3ng
Copy link

dum3ng commented Mar 31, 2018

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?

@r0man
Copy link
Owner

r0man commented Mar 31, 2018

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.

@augustl
Copy link

augustl commented Jan 8, 2019

Just discussed this over at the Rum issue tracker :)

tonsky/rum#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!

@r0man
Copy link
Owner

r0man commented Jan 8, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants