Skip to content

Instantly share code, notes, and snippets.

View hmetgundogdu's full-sized avatar
🌴
On vacation

Ahmet Gündoğdu hmetgundogdu

🌴
On vacation
View GitHub Profile
@rmorse
rmorse / react-router-dom-v.6.02.prompt.blocker.js
Last active January 12, 2026 13:14
Adds back in `useBlocker` and `usePrompt` to `react-router-dom` version 6.0.2 (they removed after the 6.0.0 beta, temporarily)
/**
* These hooks re-implement the now removed useBlocker and usePrompt hooks in 'react-router-dom'.
* Thanks for the idea @piecyk https://github.com/remix-run/react-router/issues/8139#issuecomment-953816315
* Source: https://github.com/remix-run/react-router/commit/256cad70d3fd4500b1abcfea66f3ee622fb90874#diff-b60f1a2d4276b2a605c05e19816634111de2e8a4186fe9dd7de8e344b65ed4d3L344-L381
*/
import { useContext, useEffect, useCallback } from 'react';
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom';
/**
* Blocks all navigation attempts. This is useful for preventing the page from
* changing until some condition is met, like saving form data.
@xeoncross
xeoncross / react-state-management.md
Last active September 13, 2022 08:01
Comparison of react state management + Dev story + Testing for Redux Toolkit, Zustand, Jotia, and Valtio

A demo "counter" + async application (codesandbox) is provided for each of the following four state libraries. The Zustand codesandbox includes three versions: vanila, immer, and redux-like

Redux Toolkit

OpenAPI

RTK Query has a (currently experimental) code-gen tool that will take an OpenAPI spec or GraphQL schema and give you a typed API client, as well as provide methods for enhancing the generated client after the fact.

@wojteklu
wojteklu / clean_code.md
Last active May 5, 2026 11:23
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules