dzcode-io / dzcode.io

Website for Algerian open-source community
https://dzcode.io
MIT License
115 stars 41 forks source link

fix: use `@loadable/component` instead of react lazy and cache page loads #528

Closed ZibanPirate closed 1 year ago

ZibanPirate commented 1 year ago

Description

pages unmount and mount unnecessarily because React.lazy is a factory and it produces new component on each render.

so instead we now use @loadable/component which fixes this problem by caching each component with a key.

Type of change