What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-09 18:08:02
search bar idle time react js
How about a custom hook? import {useEffect, useRef, useState} from "react"; export default function useSearchInputState(searchHandler) { // to prevent calling the handler on component mount const didMountRef = useRef(false); const [s... Add solution -
Javascript 2021-09-09 11:31:01
mockimplementation for setstate
import * as React from 'react'; describe('Some message', () => { const setState = jest.fn(); // eslint-disable-next-line @typescript-eslint/no-explicit-any const useStateMock: any = (initState: any) => [initState, setState]; afterE... Add solution -
Other 2021-09-08 19:12:03
file ignored because of a matching ignore pattern. use "--no-ignore" to override
One workaround I know at the moment is --quiet option, which suppresses all warnings. Of course that doesn't make sense if you have "warn" rules in your config. Another way not to show that warning is to use dir names: eslint src instead of glo... Add solution -
Shell/Bash 2021-08-30 04:38:02
eslint prettier reactjs
$ yarn add eslint prettier eslint-config-prettier eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks # .eslintrc { "parser": "babel-eslint", "extends": ["airbnb-base", "prettier"], ... Add solution -
Shell/Bash 2021-08-29 21:15:02
how to install gatsby with typescript
# Install this on the current gatsby project npm install gatsby-plugin-typescript & npm install typescript --save-dev # Yarn yarn add gatsby-plugin-typescript & yarn add typescript --dev # gatsby-config.js module.exports = { plugins: [ `gat... Add solution