React-redux-router推动动作/减速器

时间:2017-08-31 05:33:43

标签: reactjs react-redux react-router-v4

我有一个简单的点击处理程序,它将一个对象(selectedPost)传递给一个动作 - 下面是组件:

class SearchBarContainer extends Component {
  render() {
    return (
        <div>
          <div className="center-xs">
            <p>To get started, type in some keywords below</p>
          </div>
          <SearchBar onTermChange={this.props.actions.loadPosts} onNull={this.props.actions.nullPosts}/>  
          <PostList posts={this.props.posts} isFetching={this.props.isFetching} onClick={this.props.actions.selectPost}/>
        </div>
    );
  }
}

以下是行动:

export function selectPost(post) {
  return {
    type: SELECT_POST,
    payload: post
  }
}

我想要做的是同时将push更改为/ product / foo,但是我无法弄清楚我把这段代码放在哪里 - 任何帮助都赞赏

1 个答案:

答案 0 :(得分:1)

您可以通过调用函数 >>> text = 'Allowed Hello Hollow' >>> place = 0 >>> while text.find('ll', place) != -1: print('ll found at', text.find('ll', place)) place = text.find('ll', place) + 2 ll found at 1 ll found at 10 ll found at 16 然后更改路径以及从函数中调用操作来完成此操作

onClick