Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import { Redirect } from 'react-router-dom';
- import { connect } from 'react-redux';
- import { getRedirectPath } from './redirectSelectors';
- import { resetRedirectState } from './redirectActions';
- class RedirectContainer extends Component {
- render() {
- if (this.props.to) {
- return <Redirect to={this.props.to} />;
- }
- return null;
- }
- }
- const mapStateToProps = state => ({
- to: getRedirectPath(state),
- });
- const mapDispatchToProps = {
- resetRedirectState,
- };
- export default connect(
- mapStateToProps,
- mapDispatchToProps
- )(RedirectContainer);
Add Comment
Please, Sign In to add comment