File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 203203- On MRI, you'll get a deadlock with ` pool_size ` > 1
204204- If you're using JRuby, you can increase ` pool_size ` to have real multi-threaded rendering.
205205
206+ ### Rendering components instead of views
207+
208+ Components can also be prerendered directly from a controller action with the custom ` component ` renderer. For example:
209+
210+ ``` ruby
211+ class TodoController < ApplicationController
212+ def index
213+ @todos = Todo .all
214+ render component: ' TodoList' , props: { todos: @todos }, tag: ' span'
215+ end
216+ end
217+ ```
218+
219+ This custom renderer behaves the same as a normal view renderer and accepts the usual arguments - ` content_type ` , ` layout ` , ` location ` and ` status ` .
220+ By default, your current layout will used and the component will be rendered in place of ` yield ` instead of a view.
221+
206222### Component generator
207223
208224` react-rails ` ships with a Rails generator to help you get started with a simple component scaffold.
You can’t perform that action at this time.
0 commit comments