lib/reactive-router/component.rb in reactive-router-0.7.3 vs lib/reactive-router/component.rb in reactive-router-0.7.4

- old
+ new

@@ -1,28 +1,40 @@ module React module Component module ClassMethods - + + def url_param_evaluators + @url_param_evaluators ||= {} + end + + attr_accessor :evaluated_url_params + def router_param(name, &block) - define_state name - before_mount do - send("#{name}!", yield(params[:params][name])) + + url_param_evaluators[name] = block + + class << self + define_method name do + evaluated_url_params[name] + end end - before_receive_props do |new_params| - send("#{name}!", yield(new_params[:params][name])) + + define_method name do + self.class.send(name) end + end - + end - def route_handler - Router::RR::RouteHandler() + def route_handler(*args) + Router::RR::RouteHandler(*args) end def link(opts = {}, &block) opts[:params] = opts[:params].to_n if opts[:params] Router::RR::Link(opts, &block) end - + end end