Callbacks

suggest change

Hyperloop supports the React lifecycle callbacks with an Active Record-style syntax:

class SomeCallBacks < Hyperloop::Component
  before_mount do
    # initialize state; this replaces the usual initialize method
  end

  after_mount do
    # the generated DOM node and window are available here
  end

  before_unmount do
    # cleanup, such as canceling timers
  end

  # or name a method:
  before_mount :do_some_more_initialization
end

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents