Skip to content

Instantly share code, notes, and snippets.

View KATT's full-sized avatar
🌴
On vacation

Alex / KATT KATT

🌴
On vacation
View GitHub Profile
import { Router } from 'next/router';
import { useEffect } from 'react';
import { publicConfig } from '~/shared/config';
import { trpc } from '~/utils/trpc';
let initVersion = publicConfig.GIT_COMMIT;
function useDetectVersionChange() {
const healthQuery = trpc.health.useQuery(undefined, {
refetchInterval: 10_000,

I've been working with React since 2015 so it's more than "a feeling", so trying to put words on my reasoning below. Obviously open for input and to be proven wrong.

Why colocating code is often preferable over breaking it up into files

Optimize for code deletability confidence in changes

  • Once you remove pages/X.jsx and everything is vendored - you'll automatically delete all the dependencies without leaving any traces
  • With our linting, you will prompted to delete unused code automatically