LauraBeatris / use-selected-items-hook

Easily select items based on an array

Home Page:https://use-selected-items-hook.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Author Languages Stars Forks Contributors NPM


Check out the example


๐Ÿ“Œ Table of Contents

๐Ÿ‘ท Installation

With Yarn

yarn add use-selected-items-hook

With NPM

npm install use-selected-items-hook

๐Ÿ“Œ Go to example

๐Ÿ’ป API

Initialization

To initialize the items array, the initialItems must be passed as an argument. It's also possible to initialize the items already with an isSelected state, but to do so, it's necessary to provide the initialSelectedItems argument.


Return Values

  • selectedItems: The items that are currently selected.
  • listItems: The items with the status of isSelected. Refer to the Usage.

Actions

  • toggleSingleItem

  • toggleAllItems

๐Ÿ”จ Builds

  • es (EcmaScript module)
  • cjs (CommonJS)

๐Ÿ“ฎ Faq

Question: What are the technologies used in this project?

Answer: The technologies and libraries used in this project are React + TypeScript and Immutability Helper to handle the array manipulation.

๐Ÿ› Issues

Feel free to file a new issue with a respective title and description on the the useSelectItems hook repository. If you already found a solution to your problem, I would love to review your pull request! Have a look at our contribution guidelines to find out about the coding standards.

๐ŸŽ‰ Contributing

Check out the contributing page to see the best places to file issues, start discussions and begin contributing.

๐Ÿ“• License

Released in 2020

This project is under the MIT license.

Made with love by Laura Beatris ๐Ÿ’œ๐Ÿš€

About

Easily select items based on an array

https://use-selected-items-hook.vercel.app

License:MIT License


Languages

Language:TypeScript 93.0%Language:JavaScript 6.7%Language:CSS 0.3%