0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【React】react-routerを使用した画面遷移の方法

Posted at

サンプルコード

.ts
import { useHistory } from 'react-router-dom';

const history = useHistory();

// 履歴を追加する
history.push('/foo');

// 履歴を書き換える
history.replace('/foo');

// 履歴を2つ進める
history.go(2);

// 履歴を1つ戻る
history.goBack();

// 履歴を1つ進める
history.goForward();
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?