BFE.dev
React Coding Questions12. useArray()

12. useArray()

ReactHooks
Share

  - accepted / - tried

When array is used in React state, we need to deal with actions such as push and remove.

Implement useArray() to make life easier.

const {value, push, removeByIndex} = useArray([1, 2, 3])
prevnext

Bugfree ordinary solution is better than buggy fancy ones.

Request SolutionAIPosts(115)

Try it out

Console