Skip to content

Instantly share code, notes, and snippets.

View taion's full-sized avatar
👹
Kappa

Jimmy Jia taion

👹
Kappa
View GitHub Profile
const Benchmark = require('benchmark');
const _ = require('lodash');
const props = {
className: 'foo',
onClick: () => null,
children: 'bar',
style: { top: 10 },
relay: {},
intl: {},
class Post {
static Resource = HttpResource;
static resourceConfig = { endpoint: '/posts' };
@field({ required: true }))
title = 'untitled';
@field()
text = '';
@taion
taion / async-props-style.js
Last active January 24, 2017 17:14
React Router data fetching
// Define your components like:
class MyComponent extends React.Component {
static fetchData = (params) => {
// return an action here.
};
/* ... */
}
function fetchComponentData(component, store, params) {
@taion
taion / registry.js
Last active May 7, 2019 21:48
Relay type registry
import decamelize from 'decamelize';
import { fromGlobalId } from 'graphql-relay';
import pluralize from 'pluralize';
import getItem from '../api/getItem';
const types = {};
const endpoints = {};
const getItemOverrides = {};