Skip to content

Instantly share code, notes, and snippets.

View negarjf's full-sized avatar
🤓

Negar negarjf

🤓
View GitHub Profile
@negarjf
negarjf / Timer.js
Last active November 3, 2019 06:24
Timer for count-down and count-up
/**
* Timer class for count-down and count-up
*/
class Timer {
constructor (duration = 0, countDown = true, step = 1) {
this.duration = duration;
this.countDown = countDown;
this.step = step;
this.opr = countDown ? -1 : 1;
this.currentTime = this.freshCurrentTime;
@negarjf
negarjf / UserProvider.jsx
Last active January 1, 2021 22:51
UserProvider step 1
import React, {createContext, useReducer} from 'react';
import initialState from "./initialState";
import reducer from "./reducer";
import useActions from "./useActions";
export const UserContext = createContext();
export const UserProvider = ({children}) => {
const value = {user: null};