Narcissistic Preening Monarch
    Have ideas to improve npm?Join in the discussion! »

    react-usepopstate

    1.0.1 • Public • Published

    React window event listener popstate

    Installation

    Using npm:

    $ npm install --save react-usepopstate

    Using yarn:

    $ yarn add react-usepopstate

    Quick Start

    import React from 'react';
    import usePopstate from 'react-usepopstate';
    
    const render = () => {
      	const { isBackButtonClicked } = usePopstate({
        isPrompt: true,
    		alertDescription: 'Confirm back',
    		callback: () => {
    			alert('BACK')
    		},
    	})
     
      return (
        <>
          <div>Hello React!</div>
        </>
      );
    }

    Documentation

    const { isBackButtonClicked } = usePopstate({ isPrompt, alertDescription, callback })

    Parameters object

    • alertDescription {String} Confirm prompt description
    • callback {Function} Callback function
    • isPrompt {Booleen} Use confirm propmt default : false

    Return value

    • isBackButtonClicked {Booleen} Back status

    Contributing

    Feel free to submit any issues or pull requests.

    License

    MIT

    Install

    npm i react-usepopstate

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    13.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar