Create a TransitionGroup component that provides three hooks!
- Component Will Enter
- Component Will Leave
- Component Will Update
Component Will Update is for items that were previously in the list, that are no longer in the list.
This is somewhat available today by using the componentWillUpdate instance method on a component, but I don't want to have to provide specific props to check. I want the TransitionGroup to just tell me
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { spring } from './spring.js'; | |
class TheComponent extends Component { | |
componentWillEnter() { | |
spring(this.renderPosition, 0); | |
} | |
componentWillLeave() { | |
spring(this.renderPosition, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// React component to place Font Awesome items on the page! | |
import React, { PropTypes } from 'react' | |
import cx from 'classnames' | |
const Icon = React.createClass({ | |
propTypes: { | |
name: PropTypes.string.isRequired, | |
classNames: PropTypes.string | |
}, |
-
Commit your work to branch
-
git checkout master
-
git pull
-
git checkout [branch-name]
-
git rebase master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const goTo = (viewName, opts = {}) => { | |
return (dispatch, getState) => { | |
const tabName = opts['tabName'] | |
const params = opts['params'] | |
const goingBack = opts['goingBack'] | |
const state = getState() | |
const currentTab = getCurrentTab(state) | |
let view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initial State | |
{ | |
status: 'pending', | |
initial: null, | |
items: [], | |
reducer: null, | |
iterations: [] | |
} | |
// Set Initial Value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compose = (...funcs) => { | |
//... if statements removed for clarity | |
const last = funcs[funcs.length - 1] | |
const rest = funcs.slice(0, -1) | |
return (...args) => rest.reduceRight((composed, f) => f(composed), last(...args)) | |
} | |
// Examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compose = (...funcs) => { | |
if (funcs.length === 0) { | |
return (arg) => arg | |
} | |
if (funcs.length === 1) { | |
return funcs[0] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compose = (...funcs) => { | |
if (funcs.length === 0) { | |
return (arg) => arg | |
} | |
if (funcs.length === 1) { | |
return funcs[0] | |
} | |
const last = funcs[funcs.length - 1] |
NewerOlder