Skip to main content

Navigate

还没翻译译自英文(reactrouter.com)本页 18 段都还没译

Navigate

Framework Data Declarative

Summary

Reference Documentation ↗

A component-based version of useNavigate to use in a React.Component class where hooks cannot be used.

It's recommended to avoid using this component in favor of useNavigate.

<Navigate to="/tasks" />

Signature

function Navigate({ to, replace, state, relative }: NavigateProps): null

Props

relative

How to interpret relative routing in the to prop. See RelativeRoutingType.

replace

Whether to replace the current entry in the History stack

state

State to pass to the new Location to store in history.state.

to

The path to navigate to. This can be a string or a Path object