Skip to content

Instantly share code, notes, and snippets.

View St2r's full-sized avatar
🐟
touching fish

St2r

🐟
touching fish
View GitHub Profile
@OnurGvnc
OnurGvnc / clearBrowserExtensionInjectionsBeforeHydration.ts
Last active September 24, 2024 09:20
removes injected HTML codes from browser extensions for react hydration
import { RemixBrowser } from '@remix-run/react'
import { startTransition, StrictMode } from 'react'
import { hydrateRoot } from 'react-dom/client'
function clearBrowserExtensionInjectionsBeforeHydration() {
document
.querySelectorAll(
[
'html > *:not(body, head)',
'script[src*="extension://"]',
@spro
spro / next-ssr-recoil-effects.js
Last active December 23, 2022 09:16
Another attempt at SSR with Recoil - setting initial atom values with Next.js getServerSideProps, this time with effects
import {useEffect, useMemo} from 'react'
import {RecoilRoot, useRecoilState, atom} from 'recoil'
// User data
const user1 = {username: 'joe', bio: "You will never see me, unless of course this example is totally broken."}
const user2 = {username: 'bob', bio: "I am the one true user."}
const user3 = {username: 'fred', bio: "Just kidding, make way for the new guy."}
// A potentially dangerous mutable global variable for initial state. The main