Redux Simple Router - Change Status and URL

Let's say I have logic where the user has a list of options to choose from. When a user selects an option, the application state and URL should reflect that choice. My URL routing is understood, but I wanted to know about a better strategy. Do i need to use pushpath simplex-router and submit the action? Does the redux-simple-router API have an API for changing the state of an application directly through a route? Or can I change the state of the application elsewhere? Code below:

    handleClick(value) {
        this.props.pushPath('/Options/' + value);
    }

    render() {
      return (
        <div className="container">
          <div>Search bar here</div>
           <div className={styles.tile_container}>
             {this.state.options.map(option =>
               <div name= {option.name} key={option.key}  onClick={this.handleClick.bind(this, option.name)}>{option.name}</div>
           )}
         </div>
      </div>
    );
  }
+4
source share
1 answer

, - . React Router, Redux. , , .

, , " " , Redux dispatch.

+3

Source: https://habr.com/ru/post/1623716/


All Articles