Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I use a very large portion of the hooks present in this repo, so I thought I might as well give back one of my own; one that seemed like it could be of some common use.
This PR adds a hook called
useCollectionService
that takes in a paramtag: string
. It will keep track of instances added and removed under the given tag, and return it in a stateful array.This PR also includes a
README.md
and tests for the added hook.Also, I'm not completely set on the name. If you have alternative proposals, I'm open to them. Some alternative I thought of were:
useTagged
/useTag
=> very valid alternative nameuseInstances
=> doesn't really convey the tag usage- and also conflicts with certain libraries, I'm pretty sure.