Skip to content

Instantly share code, notes, and snippets.

View guamacherox's full-sized avatar
🎯
Focusing

Juan Marval guamacherox

🎯
Focusing
View GitHub Profile
@guamacherox
guamacherox / useErrorHandler.js
Last active April 8, 2023 14:46
React Hook for axios error interceptor
import { useEffect } from 'react';
import axios from 'axios';
/**
* @description Hooks an axios error interceptor for your react application
*/
const useErrorHandler = () => {
const errorInterceptor = axios.interceptors.response.use(
res => res,
@guamacherox
guamacherox / useDebounce.js
Last active March 31, 2021 01:17
React hook for handling debounce using lodash debounce
import { useRef } from 'react';
import debounce from 'lodash/debounce';
import PropTypes from 'prop-types';
function useDebounce(customFunction, t = 500) {
const debouncedFunction = useRef(debounce(customFunction, t)).current;
return debouncedFunction;
}
@guamacherox
guamacherox / .prettierrc
Created March 18, 2020 12:23
My Prettier Conf
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"printWidth": 120
}
@guamacherox
guamacherox / media-query.css
Created September 27, 2017 18:46 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS