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

Intelligently accept React::Elements #103

Closed
catmando opened this issue Dec 15, 2015 · 2 comments
Closed

Intelligently accept React::Elements #103

catmando opened this issue Dec 15, 2015 · 2 comments
Milestone

Comments

@catmando
Copy link
Collaborator

given this:

class MyComponent < React::Component::Base
  param :foo type: React::Element
  ...
end

we should then be able to say

MyComponent(div { "hello"}) instead of MyComponent(div {"hello"}.as_node)

This may not be easily implementable but it sure would be nice. I'm just not sure if apply as_node inside of another components' validator will work, because by that time we may not know the rendering context.

Furthermore if the param is any other type that responds to to_s we should automatically convert it (by doing a .to_s.span) This we can easily do.

@ajjahn ajjahn added this to the 0.9.x milestone Dec 15, 2015
@catmando
Copy link
Collaborator Author

Looks like we are sort of already doing this in 0.7... any Elements passed to other other elements are automatically removed from the rendering buffer.

@sollycatprint
Copy link

This issue was moved to ruby-hyperloop/hyper-react#103

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

No branches or pull requests

3 participants