$results = collect();
$itemsByMart->each(function ($item, $key) use ($customProductsByMart, $results) {
$push = $customProductsByMart->has($key) ? $item->mergeRecursive($customProductsByMart->get($key)) : $item;
$results[$key] = $push;
});
$customProductsByMart->each(function ($item, $key) use ($results) {
if (!$results->has($key)) {
$results[$key] = $item;
}
});
const initialState = {auth: {}, lotteries:{}, categories: {}, tickets:{}}
const reducer = combineReducers({ auth, lotteries, categories, tickets})
// для главного (статического) списка
const parent = [{id: 1, text: 'top1'}, {id: 2, text: 'top2'}, {id: 3, text: 'top3'}]
// для зависимого (динамического) списка
const child = [{1: { id: 1, text: 'child1-1', id: 2, text: 'child1-2', id: 3, text: 'child1-3' }}]
const selected = parent[0]
$('#parentSelect')
.select2({ data: parent })
.val(selected)
.trigger("change")
.on("change", (e) => $('#childSelect').empty().select2({ data: child[e.target.value] }));
$('#childSelect').select2({ data: child[selected.id] })
child
нужно дополнить <Route path='/info' component={Info}/>
<Info />
меняешь куски...
<nav>
<ul className='info-menu-list'>
<li className='info-menu-item'>
<NavLink to={this.props.match.path}>Валютный курс</NavLink>
</li>
<li className='info-menu-item'>
<NavLink to={this.props.match.path + '/market'}>Валютный рынок</NavLink>
</li>
<li className='info-menu-item'>
<NavLink to={this.props.match.path + '/rialto'}>Валютная биржа</NavLink>
</li>
<li className='info-menu-item'>
<NavLink to={this.props.match.path + '/nbu'}>НБУ</NavLink>
</li>
<li className='info-menu-item'>
<NavLink to={this.props.match.path + '/law'}>Закон</NavLink>
</li>
</ul>
</nav>
...
...
<Switch>
<Route exact path={this.props.match.path + '/market'} component={InfoMarket} />
<Route exact path={this.props.match.path + '/rialto'} component={InfoRialto} />
<Route exact path={this.props.match.path + '/nbu'} component={InfoNbu} />
<Route exact path={this.props.match.path + '/law'} component={InfoLaw} />
<Route exact path={this.props.match.path} component={InfoRates} />
</Switch>
...
// actions.js
export const increaseNumber = value => ({ type: 'INCREASE_NUMBER', value })
//reducer.js
...
case 'INCREASE_NUMBER':
return {...state, value: state.value + action.value}
...
// SmallApp.js
import { increaseNumber } from '..путь до/actions'
...
render(){
return (
<div>
<AddComponent add = {this.props.increaseNumber} />
</div>
)
}
...
export default connect(mapStateToProps, { increaseNumber })(SmallApp)