> For the complete documentation index, see [llms.txt](https://shhn0509.gitbook.io/react/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shhn0509.gitbook.io/react/react-router/what-is-react-router/use-history-push-method.md).

# history:push()로 페이지 이동 설정

## 1. \<button> 요소 사용&#x20;

`<Link>`를 사용하지 않고`<button>`을 사용해서 페이지 이동 설정을 하기 위해서는 `history` 객체의 `push()` 메서드를 사용할 수 있다.&#x20;

```javascript
import { useHistory } from "react-router-dom";

function HomeButton() {
  let history = useHistory();

  function handleClick() {
    history.push("/home");
  }

  return (
    <button type="button" onClick={handleClick}>
      Go home
    </button>
  );
}
```

## 2. \<a> 요소 사용&#x20;

```javascript
<a
  href="#go-to-movies"
  onClick={(e) => {
    e.preventDefault()
    history.push('/movies')
  }}
>
```
