Skip to content

Instantly share code, notes, and snippets.

Riccardo Attilio Galli riquito

Block or report user

Report or block riquito

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@riquito
riquito / makeWithConsumer.js
Created Sep 12, 2018
Create an higher order component that receives props from a context consumer.
View makeWithConsumer.js
/**
* Create an higher order component that receives props from a context consumer.
*
* // e.g. Create your with<SomeConsumer> function
* // const withDispatch = makeWithConsumer(DispatchContext.consumer, 'Dispatch')
*
* // e.g. pass the consumer props as they are
* const ButtonConnected = withDispatch(Button)
*
@riquito
riquito / withShouldComponentUpdate.js
Created Apr 16, 2018
Wrap a component with a shouldComponentUpdate call
View withShouldComponentUpdate.js
import React, { Component, Fragment } from 'react';
export const withShouldComponentUpdate = (WrappedComponent, func) => {
class WithShouldComponentUpdate extends Component {
displayName = `WithShouldComponentUpdate(${getDisplayName(
WrappedComponent,
)})`;
shouldComponentUpdate = (nextProps, nextState) =>
func.call(this, nextProps, nextState);
render = () => (
View keybase.md

Keybase proof

I hereby claim:

  • I am riquito on github.
  • I am riquito (https://keybase.io/riquito) on keybase.
  • I have a public key whose fingerprint is 3DBC 89B5 5FBE 7FFC 2251 1700 7DDD E7C6 2598 3A25

To claim this, I am signing this object:

You can’t perform that action at this time.