回答編集履歴

1

軽微な修正

2023/02/27 03:13

投稿

uky
uky

スコア270

test CHANGED
@@ -4,13 +4,13 @@
4
4
 
5
5
  こちらのステータスを受け取った後に、もし成功しているのであれば、[Next Router push](https://nextjs.org/docs/api-reference/next/router) で遷移させたいページを指定してあげることで遷移させることが可能です。
6
6
 
7
- 以下雑に実装します。
7
+ 以下、tsxで雑に実装します。※ jsxの場合でも同様に動くと思います
8
8
 
9
9
  ``` tsx
10
10
  const router = useRouter()
11
11
 
12
12
  const action = async () => {
13
- await loginApi(args: {}).then(res => {
13
+ await loginApi(args: {/** 必要な引数 */}).then(res => {
14
14
  if (res === 'success') {
15
15
  router.push('/hoge')
16
16
  } else {
@@ -21,5 +21,5 @@
21
21
  })
22
22
  }
23
23
 
24
- return <button onClick={action} /> // 雑です
24
+ return <LoginButton onClick={action} /> // 雑です
25
25
  ```