This file contains hidden or 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 { connect } from 'react-redux'; | |
import PhotoList from 'components/PhotoList'; | |
import { fetchPhotos } from './modules/Photos/actions'; | |
const mapStateToProps = state => ({ | |
photos: state.photos.photos, | |
}); | |
const mapDispatchToProps = { |
This file contains hidden or 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 { ADD_PHOTOS } from './actions'; | |
function getInitialState() { | |
return { | |
photos: [], | |
}; | |
} | |
export default function reducer(state = getInitialState(), action) { | |
switch (action.type) { |
This file contains hidden or 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 api from './api'; | |
export const ADD_PHOTOS = 'Photos/ADD_PHOTOS'; | |
export function addPhotos(photos) { | |
return { | |
type: ADD_PHOTOS, | |
payload: photos, | |
}; | |
} |
This file contains hidden or 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
class Child extends Component { | |
state = this.props.cachedState | |
? this.props.cachedState | |
: { | |
value: 0, | |
}; | |
componentWillUnmount() { | |
if (this.props.saveState) { | |
this.props.saveState(this.state); |
This file contains hidden or 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 { CHANGE_TEAM } from 'modules/Team/Team'; | |
const getCurrentTeamId = () => window.localStorage.getItem('current-team'); | |
const readTeamData = teamId => { | |
const newStateData = window.localStorage.getItem(`team-data-${teamId}`); | |
if (newStateData) { | |
return JSON.parse(newStateData); | |
} |
NewerOlder