https://github.com/aaronvb/rails_react_stdio
Ruby on Rails wrapper for react-stdio.
https://github.com/aaronvb/rails_react_stdio
rails react ruby stdio
Last synced: 8 months ago
JSON representation
Ruby on Rails wrapper for react-stdio.
- Host: GitHub
- URL: https://github.com/aaronvb/rails_react_stdio
- Owner: aaronvb
- License: mit
- Created: 2016-02-01T09:07:33.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-03T02:16:25.000Z (almost 10 years ago)
- Last Synced: 2025-03-30T13:41:28.721Z (9 months ago)
- Topics: rails, react, ruby, stdio
- Language: Ruby
- Homepage:
- Size: 12.7 KB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/aaronvb/rails_react_stdio)
[](https://coveralls.io/github/aaronvb/rails_react_stdio?branch=master)
***
# rails_react_stdio
This is a simple Ruby on Rails wrapper for [react-stdio](https://github.com/mjackson/react-stdio).
If you're not familiar with react-stdio, here's a snippet from their repo:
> react-stdio lets you render React components on the server, regardless of the backend technology you're using.
## Requirements
- [npm](https://www.npmjs.com/)
- [react-stdio](https://github.com/mjackson/react-stdio)
- [Ruby on Rails](http://rubyonrails.org/)
## Installation
Add `rails_react_stdio` to your gemfile:
```ruby
gem 'rails_react_stdio', '~> 0.1.0'
```
If your path to react-stdio is not installed in the default location `/usr/local/bin/react-stdio`, add a configuration file to your initializers folder.
```ruby
RailsReactStdio.configure do |config|
config.react_stdio_path = '/your/path/to/react-stdio'
end
```
## Usage
Using rails_react_stdio is very _simple_. You just need to provide a location to your component file, and any props you wish to pass to it as a hash.
```ruby
path_to_component = ::Rails.application.assets['components/HelloWorld'].filename
RailsReactStdio::React.render(path_to_component, {message: "aaron"})
> "
Hello, aaron
"
```