lxsunbin
V2EX  ›  React

react 重定向问题?

  •  
  •   lxsunbin · Jan 3, 2019 · 2624 views
    This topic created in 2691 days ago, the information mentioned may be changed or developed.

    初学者。。我在一个组件里重定向到另一个组件

    constructor(props: any) { super(props); this.props.history.push('/auth_manage') };

    重定向是成功了,但是该组件剩下的函数(render())之类的都执行了,如何在这里直接跳出这个组件呢?

    2 replies    2019-01-04 14:48:37 +08:00
    stantbyme
        1
    stantbyme  
       Jan 4, 2019 via iPhone
    在 coponenntwillmount 里面试试
    jszyhq
        2
    jszyhq  
       Jan 4, 2019
    这个是 url 重定向吧。 直接在 react-router 里面处理吧
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3779 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 04:42 · PVG 12:42 · LAX 21:42 · JFK 00:42
    ♥ Do have faith in what you're doing.