☆ 8 r/mobile ·by Erna ·2d ago Hot reload lost all my component state after an upgrade 1631 views After upgrading React Native, fast refresh resets state in screens that used to keep it. I use hooks and export the component as default. ⧉ Copy link⚑ Report
☆ 0 S stackfan ·2d ago#1 Fast refresh preserves state only for components that export a single function and do not change hooks between edits. Check for HOC wrappers. ⧉ Copy link⚑ Report
☆ 0 E Erna ·2d ago#2 I wrapped the screen in a context provider inside the same file. ⧉ Copy link⚑ Report
☆ 0 P Paul ·2d ago#3 Move the provider to a parent file. When the exported component changes shape, fast refresh deliberately remounts it. ⧉ Copy link⚑ Report
3 replies