Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

babel-plugin-react-suspense

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-suspense

a way to wrap component with React.Suspense as `suspense` prop

latest
Source
npmnpm
Version
1.0.11
Version published
Maintainers
0
Created
Source

babel-plugin-react-suspense

a way to wrap component with React.Suspense as suspense prop.

<Component suspense={<Fallback />} />

↓ ↓ ↓ ↓ ↓ ↓

<React.Suspense fallback={<Fallback />}><Component /></React.Suspense

FeaturesGetting StartedContributors

Features

  • 🤖 Smart enough to import and use Suspense based on user source.
  • 🌟 Simply to adopt (just add new attributes or props in your element with suspense as key and value as fallback.

Getting Started

[Back to the Table of Contents] ↑

Installation

[Back to the Getting Started] ↑

  • yarn
    • yarn add babel-plugin-react-suspense
  • npm
    • npm -i babel-plugin-react-suspense

Configuration

[Back to the Getting Started] ↑

// babel configuration
-- plugins: []
++ plugins: ["babel-plugin-react-suspense"]

Usage

[Back to the Getting Started] ↑

This babel plugin will enable special prop name (attributes jsx) called suspense every JSXElement declaration. (seem like css prop, if you familiar with styled-component or emotion).

const App = () => (
  <>
    <User suspense={<Fallback />} />
  </>
);

Contributors

[Back to the Table of Contents] ↑

RiN
RiN

💻 🤔 📖 🚇 🔧

Keywords

react

FAQs

Package last updated on 15 Dec 2024

Did you know?

Socket

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.

Install

Related posts