Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: stateがundefinedになることがあるため、暫定でオプショナルチェーンを入れる #36

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions web/src/app/_features/GitHubNippouMain/GitHubNippouMain.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
// useFormStateはClient Componentでしか使えない
'use client'

Expand All @@ -19,18 +21,18 @@ export const GitHubNippouMain: FC = () => {

return (
<main className="mx-auto grid max-w-7xl gap-6 p-4 sm:p-6 lg:px-8">
{!state.success && <Alert>{state.error}</Alert>}
{state?.success === false && <Alert>{state.error}</Alert>}
<GitHubNippouForm formAction={formAction} />
<div>
<Label htmlFor="result">Result</Label>
<Textarea
name="result"
id="result"
rows={20}
defaultValue={state.success ? state.result : ''}
defaultValue={state?.success ? state.result : ''}
/>
<div className="mt-2">
<CopyToClipboardButton text={state.success ? state.result : ''} />
<CopyToClipboardButton text={state?.success ? state.result : ''} />
</div>
</div>
</main>
Expand Down
Loading