Run code after render (e.g. set focus)
Closed this issue · 2 comments
payne8 commented
Hey thank you so much for this awesome framework. I have used it for many small projects and am in the middle of a larger one now. One thing I am unsure how to do is setting focus on an input once the page has been rendered. I think I can just set a timeout in the constructor but I would prefer a cleaner more 'apprun' way of doing it.
Is there currently a way to do that?
yysun commented
You can use the life cycle function, called rendered to run code after rendering.
class C extends component {
state = {}
view = state => {}
update = { }
rendered = state => { /* ... */ }
}
payne8 commented
Awesome! I will go ahead and use that. Thank you so much!