Closed elia closed 7 years ago
Here https://github.com/inesita-rb/inesita/blob/master/opal/inesita/component.rb#L8 and https://github.com/inesita-rb/inesita/blob/master/opal/inesita/component_virtual_dom_extension.rb#L19 I have already added an init
method that should replace initialize
.
Same with Store
as you can see here https://github.com/inesita-rb/inesita/blob/master/opal/inesita/store.rb#L4 and here https://github.com/inesita-rb/inesita/blob/master/opal/inesita/application.rb#L48.
@fazibear that's great, but what I needed specifically is a hook after #with_props
, my understanding is that props aren't cached and the init happens at that stage, but I admit I didn't look into how cache works in detail. Any way this can be changed?
@elia props
are passed to component before render
. If you need a hook on every possible porps
change, you can call it in render
method. It's some kind of hack, but it will be same thing as you will add some hooks before calling render
.
It would be nice to have before_render
hook :)
Example:
def some_hook
# props are refreshed
end
def render
some_hook
div do
#other markup
end
end
Hi, from 0.5.0
you can use before_render
callback.
I found to be very useful to initialize stuff after getting the properties, so I ended up addind an
after_props
hook to allow for it. I think it would be ok to add hooks for the three major events that happen after initialization.