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

React::NativeLibrary for re-using JS based react components #139

Open
barriehadfield opened this issue Apr 8, 2016 · 2 comments
Open

React::NativeLibrary for re-using JS based react components #139

barriehadfield opened this issue Apr 8, 2016 · 2 comments

Comments

@barriehadfield
Copy link

Not so much an issue as a feature request, but I am looking for a clean natural way of re-using JS based React components alongside ruby based JS components.

In trying to get this to work, I have been using React::NativeLibrary as a base class then importing the JS component but this does not work as React::NativeLibrary expects a JS library not a react component.

The code I would like to write is something along these lines:

class TimeAgo < React::NativeLibrary
# something to import a JS based react component (*react timeago in this example)
end

And then to use this something like:

TimeAgo(date: "Jan 1, 1990") {}

Many thanks!

@barriehadfield
Copy link
Author

PS: I have written up the issue on StackOverflow and also added a workaround here: http://stackoverflow.com/questions/36466338/how-do-i-import-a-javascript-or-jsx-based-component-into-react-rb-so-it-is-acces/36499842#36499842

@sollycatprint
Copy link

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

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

2 participants