Skip to content

Instantly share code, notes, and snippets.

View heldr's full-sized avatar
🍵

Helder Santana heldr

🍵
View GitHub Profile
@heldr
heldr / withToggle.js
Created September 20, 2016 15:43
Higher order component to toggle a prop value
/**
* Higher order component to toggle a prop value
*
* @see https://goo.gl/q7mQGm
* @function withToggle
* @returns Component
*/
export default function withToggle(WrappedComponent, propName = 'bool') {
class WithToggle extends Component {
constructor(props, context) {
@heldr
heldr / App.tsx
Last active February 13, 2019 03:24
React hooks load page chunk (code splitting)
import React from 'react';
import { Router } from "@reach/router";
import LoadComponent from './LoadComponent';
const FoobarLoader = () => import('./pages/Foobar');
const App: React.StatelessComponent<{}> = () => (
<div>
<Router>
<LoadComponent componentAsPromised={FoobarLoader} path="foobar" />

Keybase proof

I hereby claim:

  • I am heldr on github.
  • I am heldr (https://keybase.io/heldr) on keybase.
  • I have a public key ASBwmQHJaS4fN2i0fDYzEDHmCaCeTx6qbEgvx0ZTawpNMwo

To claim this, I am signing this object: