Skip to content

Instantly share code, notes, and snippets.

// Store
state = {
artists: [],
filteredArtists: [],
currentRange: null,
currentProduct: null
}
// Helper.
@tomjamesallen
tomjamesallen / addPropsRecursively.js
Created April 4, 2016 10:11
Add multiple props to a react element and all child elements.
import React from 'react'
export default function addPropsRecursively(el, props) {
let cloneChildren = []
React.Children.forEach(el.props.children, (child) => {
let replacement = addPropsRecursively(child, props)
cloneChildren.push(replacement)
})
@tomjamesallen
tomjamesallen / js-plugin-boilerplate
Last active August 29, 2015 14:07
Js Plugin boilerplate
;(function (window, $) {
var plugin = function (options, initOnAssign) {
var api = {}, op;
// Establish plugin defaults.
var defaults = {
// documentReady, windowLoad, immediate
initOn: 'windowLoad',
};
// A starting point for js plugins.
(function (window, $) {
var plugin = function (options, initOnAssign) {
var api = {}, op;
// Establish plugin defaults.
var defaults = {