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 collections = [ | |
{name: 'Favorite', id:1}, | |
{name: 'Trillers', id:2}, | |
{name: 'Horrors', id:3}, | |
{name: 'Comedies', id:4}, | |
] | |
const mapping = [ | |
{ collectionId: 1, filmId: 'aaa'}, | |
{ collectionId: 3, filmId: 'asasas'}, |
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 { push, replace } from 'connected-react-router'; | |
export default store => next => action => { | |
if (action.pushToUrl) { | |
const state = store.getState(); | |
const currentQueries = new URLSearchParams(state.router.location.search); | |
Object.entries(action.pushToUrl).forEach(([key, value]) => { | |
currentQueries.set(key, 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
Я помню первый галп-конфиг, | |
То бы не просто инструмент. | |
Как будто что-то я постиг, | |
Ворвался во всеобщий тренд. | |
Прощай консольный компилятор sass, | |
Прощай рутинный спрайто-генератор, | |
Прощай дублированный html-каркас, | |
Ведь есть теперь шаблонизатор. |
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 { | |
CHANGE_USERS_AGE_FILTER, | |
} from '../actions/actionTypes'; | |
import users from '../../mockData/users'; | |
import {getMaxVal, getMinVal, getValueFromUrl} from '../../utils/functions'; | |
const minAge = getMinVal(users, 'age'); | |
const maxAge = getMaxVal(users, 'age'); | |
const minAgeFilter = getValueFromUrl('users.minAge'); |
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 minAgeFilter = getValueFromUrl('users.minAge'); |
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 {browserHistory} from 'react-router'; | |
export function getValueFromUrl(input) { | |
const [pathname, prop] = input.split('.'); | |
const currentLocation = browserHistory.getCurrentLocation(); | |
if (currentLocation.pathname !== `/${pathname}`) { | |
return null; | |
} |
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 {replace} from 'react-router-redux'; | |
export default store => next => action => { | |
if (action.pushToUrl) { | |
const state = store.getState(); | |
store.dispatch(replace({ | |
pathname: state.routing.locationBeforeTransitions.pathname, | |
query: { | |
...state.routing.locationBeforeTransitions.query, |
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
case LOCATION_CHANGE: | |
if (action.payload.pathname === '/products') { | |
return { | |
...state, | |
productsPage: action.payload.query.page || state.productsPage | |
} | |
} else if (action.payload.pathname === '/users') { | |
return { | |
...state, | |
usersPage: action.payload.query.page || state.usersPage |
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 {LOCATION_CHANGE} from 'react-router-redux'; | |
const initialState = { | |
timeFilter: '1M' | |
}; | |
export const exampleReducer = (state = initialState, action) => { | |
switch (action.type) { | |
case LOCATION_CHANGE: | |
return { |
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 PropTypes from 'prop-types'; | |
class Example extends Component { | |
static contextTypes = { | |
router: PropTypes.object.isRequired | |
}; | |
onChange = () => { | |
// PUSH TO URL |
NewerOlder