Skip to content

Latest commit

 

History

History

base

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Acrool React Hooks / Base

All relatively basic Hook methods.

Features

useShow

Show/hide switch Hook

import {useShow} from '@acrook/react-hooks';
import {useEffect} from "react";

const Example = () => {
    const { isShow, show, hide, toggle} = useShow();
    
    return <>
        <p>isShow: {String(isShow)}</p>
        <button onClick={show}>Show</button>
        <button onClick={hide}>Hide</button>
        <button onClick={toggle}>toggle</button>
    </>;
}

useOnlyUpdateEffect

Only executed when componentDidUpdate

import {useUpdateEffect} from '@acrook/react-hooks';
import {useEffect} from "react";

const Example = () => {
    useUpdateEffect(() => {
        console.log('update!');
    }, []);
}