Answer the question
In order to leave comments, you need to log in
How to send an event after render?
The second day I tear my hair on my head because of the impossibility of doing the react correctly, but first a little background. When you send an event about changing an object in real code (not react), it is assumed that the object has already been changed, and based on its state, further calculations can be made.
Now let's imagine that I'm doing a drag in react and I need to send an event about start, drag, end.
But first you need to remember that in order not to get the mouse stuck, you need to sign the document on mousedown and mousemove.
And now the question is how to send an event only after react renders? Taking into account that dom events occur regardless of whether the reaction wants it or not, and it is also impossible to prohibit them or ask the user to press and move the mouse more slowly.
Do not offer ready-made solutions. I'm waiting for thoughtful answers, otherwise my opinion is that it is generally not possible to do this in React without redoing the React itself, without writing your own life cycle and your own event system. In other words, throw out the fucking react and make your own ..
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question