![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@aw-web-design/react-lazy-named
Advanced tools
React lazy() with named imports - exports support
Use React.lazy()
with named exports (or imports, if you're all opposite)
Install the react-lazy-named
package with yarn or npm.
yarn add react-lazy-named
// or
npm install react-lazy-named
Works just like React.lazy() but with an added argument - export name.
import React from 'react';
import lazy from 'react-lazy-named';
const PrimaryButton = lazy(() => import('./Buttons'), 'primary');
const MyComponent = () => (
<React.Suspense fallback={null}>
<PrimaryButton text="YES!" />
</React.Suspense>
);
So you want to use default exports? Sure, just don't use the second argument.
const Card = lazy(() => import('./Card'));
// same as
const Card = lazy(() => import('./Card'), 'default');
Some libraries like framer-motion use deeply nested components. In other words, they export objects with components in properties. Guess what, you can reach those,too!
const MotionDiv = lazy(() => import('framer-motion'), 'motion.div');
You can also use Webpack magic comments as usual.
const PrimaryButton = lazy(
() => import('./Buttons' /* webpackChunkName: "buttons", webpackPreload: true */),
'primary'
);
Your project should already be running React 16.6+ (React.lazy() required).
This project uses Jest for unit testing. To execute tests run this command:
yarn test
It's useful to run tests in watch mode when developing for incremental updates.
yarn test:watch
This project is MIT licensed.
FAQs
React lazy() with named imports - exports support
The npm package @aw-web-design/react-lazy-named receives a total of 20 weekly downloads. As such, @aw-web-design/react-lazy-named popularity was classified as not popular.
We found that @aw-web-design/react-lazy-named demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.