Skip to content

aaronvb/rails_react_stdio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status


rails_react_stdio

This is a simple Ruby on Rails wrapper for 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

Installation

Add rails_react_stdio to your gemfile:

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.

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.

path_to_component = ::Rails.application.assets['components/HelloWorld'].filename

RailsReactStdio::React.render(path_to_component, {message: "aaron"})

> "<p data-reactid=\".1on4o1jtdds\" data-react-checksum=\"359665029\">Hello, aaron</p>"

About

Ruby on Rails wrapper for react-stdio.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published