Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 373 Bytes

useList.md

File metadata and controls

22 lines (16 loc) · 373 Bytes

useList

React state hook that tracks a value of an array.

Usage

import {useList} from 'react-use';

const Demo = () => {
  const [list, {set, push}] = useList();

  return (
    <div>
      <div>{list.join(',')}</div>
      <button onClick={() => set([])}>Reset</button>
      <button onClick={() => push(Date.now())}>Push</button>
    </div>
  );
};