Skip to content

Instantly share code, notes, and snippets.

View slugmandrew's full-sized avatar
⚛️
React, ahoy!

Drew Spencer slugmandrew

⚛️
React, ahoy!
View GitHub Profile
@chaance
chaance / use-prompt.jsx
Last active December 6, 2023 12:51
Example implementation of `usePrompt` and React Router v5's `<Prompt>` with `unstable_useBlocker`
/**
* ------------------------------------------------------------------------------
* IMPORTANT UPDATE:
* This is *not* a complete implementation and I do not suggest using it!. This
* was primarily an experiment to determine whether or not a decent blocking
* hook could be implemented in userland, and the answer we came up with is NO.
*
* Luckily we added `usePrompt` (behind an `unstable_` flag) back to React Router
* a few versions ago! It's not documented [and I'm no longer on the team, so I
* probably won't try to do anything about that], but you can see it in source.
@shumbo
shumbo / story.tsx
Last active April 15, 2024 05:07
A storybook decorator to use React Hooks Form inside stories
export default {
title: "MyComponent",
component: MyComponent,
decorators: [withRHF(false)], // or true to show submit button on story
} as Meta;
@tkrotoff
tkrotoff / FrontendFrameworksPopularity.md
Last active July 14, 2024 18:01
Front-end frameworks popularity (React, Vue, Angular and Svelte)
If you find the following useful my donation address is: aEgoFC75sP78gT55em1QYcL8DNYZ78ewJ5
1. Go here: https://console.aws.amazon.com/ec2sp/v1/spot/home?region=us-east-1
2. Click: "Request Spot Instances"
3. Request type: "Request and Maintain"
4. Choose how ever many servers/vcpus you want in the "Target Capacity" section.
@tbroyer
tbroyer / Address.java
Created January 15, 2011 00:29
Before/after GWT 2.1 Editors
package net.ltgt.gwt.samples.editors.shared;
public class Address {
private String street;
private String city;
private String zip;
private String state;
public String getStreet() { return this.street; }