The easiest way to use reduce function
npm install --save use-reduce
import * as React from 'react'
import { useAddAllElements, useMultiplyAllElements } from 'use-reduce'
const Example = () => {
const example = useAddAllElements([1,2,3,4,5])
return (
<div>
{example} // 15
</div>
)
}
MIT © justin-the-developer
This hook is created using create-react-hook.