Don't use React imports like this. Use Wrapper Pattern instead
Nikola Perišić

Nikola Perišić @perisicnikola37

About: Software Engineer | Technical Writer | 135k+ Reads

Location:
Podgorica, Montenegro
Joined:
Jun 27, 2023

Don't use React imports like this. Use Wrapper Pattern instead

Publish Date: Feb 21
65 11

Comments 11 total

  • АнонимMar 5, 2025

    [hidden by post author]

    • Nikola Perišić
      Nikola PerišićMar 13, 2025

      There are multiple benefits:

      • Developers in the codebase know what to use and import -With a wrapper, developers don’t need to think about the best way to import a library each time. They just use the predefined optimized wrapper.
      • Avoiding Redundant Imports - If every component manually imports specific thing from lodash for example, there’s a risk that different components may import some different parts of the library.
      • Ease of Maintenance - If a library updates its exports or introduces a more optimized way to import, you only need to update the wrapper file instead of refactoring every single component.
  • manuel fernando gallego arias
    manuel fernando gallego ariasMar 12, 2025

    Great to know, thanks Nikola.

  • АнонимMar 12, 2025

    [hidden by post author]

    • Nikola Perišić
      Nikola PerišićMar 13, 2025

      Well, many people who liked this article on Medium would argue with you xD

  • АнонимMar 13, 2025

    [hidden by post author]

  • АнонимMar 13, 2025

    [hidden by post author]

  • АнонимMar 13, 2025

    [hidden by post author]

Add comment