daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Oct 20th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import { Redirect } from 'react-router-dom';
  3. import { connect } from 'react-redux';
  4.  
  5. import { getRedirectPath } from './redirectSelectors';
  6. import { resetRedirectState } from './redirectActions';
  7.  
  8. class RedirectContainer extends Component {
  9.   render() {
  10.     if (this.props.to) {
  11.       return <Redirect to={this.props.to} />;
  12.     }
  13.  
  14.     return null;
  15.   }
  16. }
  17.  
  18. const mapStateToProps = state => ({
  19.   to: getRedirectPath(state),
  20. });
  21.  
  22. const mapDispatchToProps = {
  23.   resetRedirectState,
  24. };
  25.  
  26. export default connect(
  27.   mapStateToProps,
  28.   mapDispatchToProps
  29. )(RedirectContainer);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top