Skip to content

Instantly share code, notes, and snippets.

View FrancoFrancis's full-sized avatar
🎯
crafting

Francis Etham FrancoFrancis

🎯
crafting
View GitHub Profile
@adrianhajdin
adrianhajdin / StateContext.js
Last active July 11, 2024 14:11
Build and Deploy a Modern Full Stack ECommerce Application with Stripe
import React, { createContext, useContext, useState, useEffect } from 'react';
import { toast } from 'react-hot-toast';
const Context = createContext();
export const StateContext = ({ children }) => {
const getLocalStorage = (name) => {
if (typeof window !== 'undefined') {
const storage = localStorage.getItem(name);