Include popular hooks in your React projects easily with custom-hooks, with ES6 features that allows you to include only the hooks you want.
Note: This library is still in development, was not published to npm.
We have several examples on the hooks page. Here is the first one to get you started:
import { useRecognition } from 'custom-hooks';
const App = () => {
const [{ transcript, listening }, recognition] = useRecognition({
language: 'pt-BR',
});
const startSpeech = () => {
try {
listening ? recognition.stop() : recognition.start();
} catch (error) {
console.log(error.message);
}
};
return (
<>
<button onClick={startSpeech}>start speech</button>
{transcript && <span>{transcript}</span>}
</>
);
};
We'd love to have your helping hand on custom-hooks! See CONTRIBUTING.md for more information on what we're looking for and how to get started.
Custom-hooks is MIT licensed.