a costum hooks to help frontend programmers with library like react, vue and angular
npm install maj-hooksLibrary with the hooks that I use into my projects with react.
``shell`
npm i maj-hooks
`js
import { useRecognition } from 'maj-hooks';
const MyComponent = () => {
const [result, recognition] = useRecognition({ language: 'pt_BR' });
useEffec(() => {
if (result?.speech) {
/Do something/
}
}, [result.speech]);
const onSpeak = () => {
const { error, isListening } = result;
if (error) {
/Do something/
}
isListening ? recognition.stop() : recognition.start();
};
};
`
The useTheme hook provide two options of colors ('dark', and 'light').
By default the light theme is returned in the first position of array. So, to use dark theme you need to pass true, in the function that is returned in the second position of hook.
`js
import { useTheme } from 'maj-hooks';
const MyComp = () => {
const [theme, setTheme] = useTheme();
...
...
const onToggle = () => {
setTheme((prev) => !prev);
};
return (
If there is one or more hook that you are created and you think that it can help someone else, you need now clone or fork this repo and open new pr with your feature, fix bug, chore or something else.