javascript - React Re-Render Causes Flickering : How can i fix this? - Stack Overflow

I’m new in coding and i couldn’t get how to fix the issue after i googled many times. The issue is i ha

I’m new in coding and i couldn’t get how to fix the issue after i googled many times. The issue is i have a layout ponent which contains 4 different ponents. When i call a function in a function ponent it affects the others and the others re-render. Re-render is fine tho however my images are flickering on mobile browser. I would like to remove the flickering of the image loading. I’ve tried using React.memo() and useCallBack() but both of them didn’t work for me. I hope I made myself clear , thanks in advance

This is my app

I’m new in coding and i couldn’t get how to fix the issue after i googled many times. The issue is i have a layout ponent which contains 4 different ponents. When i call a function in a function ponent it affects the others and the others re-render. Re-render is fine tho however my images are flickering on mobile browser. I would like to remove the flickering of the image loading. I’ve tried using React.memo() and useCallBack() but both of them didn’t work for me. I hope I made myself clear , thanks in advance

This is my app https://stackblitz./github/mithatercann/qrmenu

Share Improve this question asked Mar 4, 2021 at 11:23 Mithat ErcanMithat Ercan 3994 silver badges13 bronze badges 4
  • I don't see any flickering happening. Might be a css issue – Near Commented Mar 4, 2021 at 11:28
  • It's flickering on mobile browser tho. – Mithat Ercan Commented Mar 4, 2021 at 11:31
  • I have opened it on mobile as well. Don't see any issue there – Near Commented Mar 4, 2021 at 11:33
  • It seems fine on android but it's flickering on ios . I didn't understand how it's possible. – Mithat Ercan Commented Mar 4, 2021 at 11:37
Add a ment  | 

1 Answer 1

Reset to default 3

You are using what's its called "Prop Drilling". The better solution for your current problem is to implement some state management in your app, they are many third libraries for that, but for this instance and if your app is small you can use React Context API. If you're going to build big apps then I remend implementing Redux.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745125340a4612657.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信