Skip to content

Wallet re-renders with delay if prop changes, causing flicker #38

Closed Answered by meliguicarvalho
mdwt asked this question in Q&A
Discussion options

You must be logged in to vote

Hello! Good afternoon.

The re-renders are caused by the React lifecycle and the usage of Formik. Everytime a prop changes, all the components are re-rendered, and since the Brick is a remote component, it appears to flicker on the screen.

This can be fixed by changing the way you implement the component, by using it outside the context of the form you can avoid the issue.
We created an example that simulates your issue and fixes it using React's useRef.
Please check it out here, we think it will help you: https://codesandbox.io/s/formik-walletbrick-55wn0q?file=/src/App.js:337-380

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@mdwt
Comment options

@acyment
Comment options

@lemazzo
Comment options

@acyment
Comment options

@lemazzo
Comment options

Answer selected by meliguicarvalho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
4 participants