The display of React data is always one step behind what is written directly in the tag.

for example, there are two modules on the page now, one with the "more" button

when you click more, the pop-up Modal, shows more. After closing, click another "more", you will see the data in Modal flickering into new data, how to solve this problem.
and adjust the interface data in DidMount when you first enter the page. The display of the data on the page is always one step behind other UI

.
Mar.03,2021

if the data flashes, render the data after clicking, and then pop up the second parameter of modal (setState to perform the pop-up action. Or add a loading style that is being loaded

"DidMount adjusts interface data, and the display of data on the page is always one step behind other UI":
you can see why it is slower than other data and whether it is because the amount of data returned by other APIs is larger than that returned by other APIs. Try the backend to optimize. In the case of
front-end processing, this kind of list usually loads a chrysanthemum loading and other data and then renders the page.

Of course,

can also be placed in willmount. But the experience is not good.


1. The first question, first, you click more. At this time, the data in the modal already exists. When you click another, there is a previous data in the previous modal, and the new data comes in to replace the previous data, which will produce an effect like yours.
-you can empty the data in the modal when you close modal, and it will not have such an effect.

  1. DidMount is rendered by calling the API after the component is loaded. This API is asynchronous and takes time to perform setState operations, while the original static data on the page does not need this operation, so data rendering in the lifecycle will definitely be slower
.

-I hope I can help you, hit by hand

Menu