React hook to use hardpass.
npm install react-use-hardpass --save
# or with yarn
yarn add react-use-hardpass
function App() {
const [hardpassRef, hardpassOutput] = useHardpass();
const { score, feedback } = hardpassOutput;
const isStrong = score === 4;
return (
<div>
<input ref={hardpassRef} />
{feedback && feedback.warning && <p>{feedback.warning}</p>}
{feedback && feedback.suggestions.length > 0 && (
<ul>
{feedback.suggestions.map((suggestion, key) => (
<li key={key}>{suggestion}</li>
))}
</ul>
)}
</div>
)
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);