Skip to content

Commit

Permalink
docs: When컴포넌트 props 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ssi02014 committed May 5, 2024
1 parent cd95317 commit 900c76a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .changeset/seven-pants-eat.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@modern-kit/react': patch
'@modern-kit/react': minor
---

#100 61d6df3 Thanks @soonki-98! - feat: SwitchCase Component 추가 및 When fallback props 추가
8 changes: 5 additions & 3 deletions docs/docs/react/components/When.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@ type Condition = boolean | ((...args: any[]) => boolean);

interface WhenProps {
condition: Condition;
fallback?: React.ReactNode;
}

const When: ({ children, condition }: PropsWithChildren<WhenProps>) => JSX.Element | null
const When: ({ children, condition }: PropsWithChildren<WhenProps>) => JSX.Element
```
## Usage
```tsx
import { When } from '@modern-kit/react';

const Example = () => {
const [state, setState] = useState(false);

return (
<>
<button onClick={() => setState(!state)}>Toggle Button</button>

<When condition={state}>
<When condition={state} fallback={<p>Fallback</p>}>
<h1>Render</h1>
</When>
</>
Expand All @@ -44,7 +46,7 @@ export const Example = () => {
<>
<button onClick={() => setState(!state)}>Toggle Button</button>

<When condition={state}>
<When condition={state} fallback={<p>Fallback</p>}>
<h1>Render</h1>
</When>
</>
Expand Down

0 comments on commit 900c76a

Please sign in to comment.