No commit activity in last 3 years
No release in over 3 years
Use react-stdio in your Ruby on Rails app.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

>= 3.2
 Project Readme

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>"