Skip to content

Repository files navigation

Build StatusCoverage 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.configuredo |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'].filenameRailsReactStdio::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

Stars

17 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages