How do I enable params as methods in Hyperstack

42 Views Asked by At

I would like to use:

class UserDetails < HyperComponent
  param :user

  render do
    H1 { user.name }
  end

Instead of

class UserDetails < HyperComponent
  param :user

  render do
    H1 { @User.name }
  end

How do I enable this as the default?

1

There are 1 best solutions below

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