Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added array helpers #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

added array helpers #3

wants to merge 3 commits into from

Conversation

Lagily
Copy link

@Lagily Lagily commented Mar 4, 2020

Added the generation of helpers for props, if they are arrays, this allows the user to update entries of arrays in his state easier and declarative.

@Lagily
Copy link
Author

Lagily commented Mar 4, 2020

fixed #2

todos: [],
})
const { todos } = state
const { setTodos, addTodo, replaceTodo, removeTodo } = setters

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you should look this library react-use-object-state and their array methods. It includes clean, push, pop, shift, and so on.

Also I would suggest boolean fast methods but maybe in another state hook due to performance reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants