我如何启用参数作为Hyperstack中的方法

时间:2019-04-06 03:21:35

标签: ruby-on-rails ruby reactjs isomorphic hyperstack

我想使用:

class UserDetails < HyperComponent
  param :user

  render do
    H1 { user.name }
  end

代替

class UserDetails < HyperComponent
  param :user

  render do
    H1 { @User.name }
  end

如何将其设为默认值?

1 个答案:

答案 0 :(得分:1)

class HyperComponent
  include Hyperstack::Component
  include Hyperstack::State::Observable
  param_accessor_style :accessors  # this is now the prefered param style
end