Skip to content

Commit addb697

Browse files
committed
update readme
1 parent ddfb5fc commit addb697

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,18 @@ Controllers in the app/home component do not need to be namespaced, all other co
552552

553553
Here "auth" would be the component name.
554554

555+
## Reactive Accessors
556+
557+
The default ModelController proxies any missing methods to its model. Since models are wrapped in ReactiveValue's, they return ReactiveValue's by default. Sometimes you need to store additional data reactively in the controller outside of the model. (Though often you may want to condier doing another control/controller) In this case, you can add a ```reactive_accessor```. These behave just like ```attr_accessor``` except the values assigned and returned are wrapped in a ReactiveValue. Updates update the existing ReactiveValue.
558+
559+
```ruby
560+
class Contacts < ModelController
561+
reactive_accessor :_query
562+
end
563+
```
564+
565+
Now from the view we can bind to _query while also changing in and out the model. You can also use ```reactive_reader``` and ```reactive_writer```
566+
555567
# Components
556568

557569
Apps are made up of Components. Each folder under app/ is a component. When you visit a route, it loads all of the files in the component on the front end, so new pages within the component can be rendered without a new http request. If a URL is visited that routes to a different component, the request will be loaded as a normal page load and all of that components files will be loaded. You can think of components as the "reload boundary" between sections of your app.

0 commit comments

Comments
 (0)