npm:
npm i use-hashcode
yarn:
yarn add use-hashcode
make sure you have crypto-js
npm i crypto-js
or
yarn add crypto-js
This package makes hash things easier in react using crypto-js
import { useFileHashCode } from 'use-hashcode'
const App = () => {
const { isHashLoading, isHashError, sha256 } = useFileHashCode(file, 'sha256')
const strMd5 = useStringHashCode('Hello, World', 'md5')
return (
<div>
{sha256}
{strMd5}
</div>
)
}