N
N
Ninja Mate2016-02-18 12:16:35
JavaScript
Ninja Mate, 2016-02-18 12:16:35

How can React-router pass props to reload parent component?

there is such a react component

export class App extends Component {

    render() {
        return (
        <div>
       
                            <Router history={hashHistory}>
                                <Route path="/" component={UserHome}>
                                    <Route path="newPatient" component={NewPatient}></Route>
                                </Route>
                            </Router>
           
            </div>
        );

    }
}

The page is loaded as expected from the UserHome component in which the button is located
{this.props.children}

                <Link to="newPatient">
                    <Button> Create a new Patient</Button>
                </Link>

How to make the button toggle Router in the parent component instead of adding newPatient to this.props.children ??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Ninja Mate, 2016-02-18
@victorzadorozhnyy

all in a bunch if you don't invest

<Route path="/" component={UserHome}>
                                    <Route path="newPatient" component={NewPatient}></Route>
                                </Route>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question