/acrool-react-block

react block component

Primary LanguageTypeScriptMIT LicenseMIT

Acrool React Block

Acrool React Block Logo

This is a toast message function for React development notifications

NPM npm npm

npm downloads npm

Features

  • Supports queue block list
  • Plug and unplug using @acrool/react-portal and framer-motion

Install

yarn add @acrool/react-block

Usage

add in your index.tsx

import "@acrool/react-block/dist/index.css";

add in your App.tsx

import {BlockPortal} from "@acrool/react-block";

const App = () => {
    return (
        <div>
            <BaseUsed/>
            <BlockPortal
                isVisibleQueueKey={false}
                renderLoader={<Loader/>}
                defaultMessage="Loading..."
            />
        </div>
    );
};

then in your page

import {block} from '@acrool/react-block';
import {useEffect} from "react";

const Example = () => {

    useEffect(() => {
        block.show();
        
        setTimeout(() => {
            block.hide();
        }, 3000)
    }, []);

    return (
        <div>
            sample page
        </div>
    );
};
  • block.show
  • block.hide
  • toast.hideAll

There is also a example that you can play with it:

Play react-editext-example

License

MIT © Acrool & Imagine