-
in VUE, for example, there is a $nextTick function, in its callback, we can be sure the current around of rendering has been done. in my solidjs code, I have an reactive array const [items, setItems] = createSignal([]); after I update the item array, the ui will be updated. Then after the ui has been updated, I want to scroll its container div to the bottom: but I don't know how to make sure ui update has been done? i.e. what's solidjs equivalent of $nextTick? right now, I'm doing it using setTimeout, which is stupid: setItems([...items(), 28]);
setTimeout(() => { containerDiv.scrollTop = containerDiv.scrollHeight; }, 1000); in VUE I would write: setItems([...items(), 28]);
this.$nextTick(() => {
containerDiv.scrollTop = containerDiv.scrollHeight;
}) |
Beta Was this translation helpful? Give feedback.
Answered by
shi-yan
Dec 13, 2023
Replies: 1 comment 1 reply
-
I found it |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
shi-yan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found it
https://www.solidjs.com/tutorial/introduction_effects