Skip to content

Instantly share code, notes, and snippets.

View Vikaskumargd's full-sized avatar
🎯
Focusing

Vikas Kumar Vikaskumargd

🎯
Focusing
View GitHub Profile
@macbookandrew
macbookandrew / findStyles.js
Last active March 30, 2024 15:24
List unique CSS properties for all DOM elements
/**
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer}
*
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file}
*
* @author AndrewRMinion Design (https://andrewrminion.com)
* @version 1.1
*
@johanquiroga
johanquiroga / useUndoReducer.js
Last active December 14, 2023 08:52
Undo/Redo capability for any reducer using react hook `useReducer`
import { useReducer } from 'react';
const useUndoReducer = (reducer, initialState) => {
const undoState = {
past: [],
present: initialState,
future: []
};
const undoReducer = (state, action) => {
@Dromediansk
Dromediansk / useFetch.js
Created April 8, 2020 02:59
fetching data custom hook final version
import { useState, useEffect } from "react";
export const useFetch = (url, ref, initialValue) => {
const [data, setData] = useState(initialValue);
const [error, setError] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
if (ref.current) {
(async () => {
@Vikaskumargd
Vikaskumargd / useFetch.js
Created April 9, 2020 21:53 — forked from Dromediansk/useFetch.js
fetching data custom hook final version
import { useState, useEffect } from "react";
export const useFetch = (url, ref, initialValue) => {
const [data, setData] = useState(initialValue);
const [error, setError] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
if (ref.current) {
(async () => {