| layout | title | id |
|---|---|---|
page |
Use Ruby to build Reactive User Interfaces |
home |
Reactrb lets you build beautiful interactive user interfaces using the same Ruby language running your server side code. Reactrb replaces JS code, JSX, HTML, templating languages, and complex frameworks with one simple system.
The power and simplicity of React with a great easy to use Ruby DSL. Reactrb frees you up to do what you do best - building great apps.
React components can be defined by subclassing `React::Component::Base`. The `render` callback defines the components HTML.
In addition to taking input data (such as the `visitor` param), a component can have state variables, which are like reactive instance variables. When a component's state changes, the markup will be updated by automatically by re-invoking the `render` callback.
Using params and state, we can put together a small Todo application. This example uses two state variables to track the current list of items and the text that the user has entered.