Skip to content

Instantly share code, notes, and snippets.

View Klaasvaak's full-sized avatar

Joep van der Heijden Klaasvaak

View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active November 12, 2024 19:08
Listen to your web pages
import { useState } from 'react';
// Usage
function App() {
// Similar to useState but first arg is key to the value in local storage.
const [name, setName] = useLocalStorage('name', 'Bob');
return (
<div>
<input
@Gaya
Gaya / hoc.js
Last active February 16, 2021 10:09
Pure Component HOC in React
import React from 'react';
const someProp = 'We want to pass this as a prop';
// hip and short notation
export const wrapComponent = (UncomposedComponent) => (props) => <UncomposedComponent {...props} someProp={someProp} />;
// Or broken down:
// a factory which wraps a component