Skip to content

Commit 5ca32de

Browse files
docs: update code example and some contents (#195)
Co-authored-by: seungrodotlee <seungrodotlee@gmail.com>
1 parent f942955 commit 5ca32de

4 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/docs/en/intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Introduction to react-simplikit
22

3-
How can we build React-based applications more safely and reliably? We defined the answer as 'writing React codes in a React-like way' and the answer really began to take shape through react-simplikit.
3+
How can we build React-based applications more safely and reliably? We defined the answer as 'writing React codes in a React-like way' and the answer really began to take shape through `react-simplikit`.
44

55
`react-simplikit` is a lightweight yet powerful library that provides various useful tools in React environments. It is designed to respect React's design principles while improving the React development experience.
66

@@ -38,7 +38,7 @@ right-title="with-react-simplikit.tsx">
3838
<template #left>
3939

4040
```tsx
41-
// without react simplikit
41+
// without `react-simplikit`
4242
const texts = ['hello', 'react', 'world'];
4343

4444
function Page() {
@@ -61,7 +61,7 @@ function Page() {
6161
<template #right>
6262

6363
```tsx
64-
// with react simplikit
64+
// with `react-simplikit`
6565
const texts = ['hello', 'react', 'world'];
6666

6767
function Page() {

src/docs/en/why-react-simplikit-matters.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Based on this, it guides developers to write more declarative React components.
2424
function AutoCompleteInput() {
2525
const [query, setQuery] = useState('');
2626
const [results, setResults] = useState<SearchResult[]>([]);
27-
const [isLoading, setIsLoading] = useState(false);
28-
const [isOpen, setIsOpen] = useState(false);
27+
const [isLoading, setLoading] = useState(false);
28+
const [isOpen, setOpen] = useState(false);
2929
const searchTimeoutRef = useRef<NodeJS.Timeout>(null);
3030
const containerRef = useRef<HTMLDivElement>(null);
3131

@@ -35,7 +35,7 @@ function AutoCompleteInput() {
3535
containerRef.current &&
3636
!containerRef.current.contains(e.target as Node)
3737
) {
38-
setIsOpen(false);
38+
setOpen(false);
3939
}
4040
};
4141

@@ -53,7 +53,7 @@ function AutoCompleteInput() {
5353
return;
5454
}
5555

56-
setIsLoading(true);
56+
setLoading(true);
5757
searchTimeoutRef.current = setTimeout(async () => {
5858
try {
5959
const response = await fetch(`/api/search?q=${query}`);
@@ -62,7 +62,7 @@ function AutoCompleteInput() {
6262
} catch (error) {
6363
console.error('Failed to fetch results:', error);
6464
} finally {
65-
setIsLoading(false);
65+
setLoading(false);
6666
}
6767
}, 300);
6868

@@ -80,9 +80,9 @@ function AutoCompleteInput() {
8080
value={query}
8181
onChange={e => {
8282
setQuery(e.target.value);
83-
setIsOpen(true);
83+
setOpen(true);
8484
}}
85-
onFocus={() => setIsOpen(true)}
85+
onFocus={() => setOpen(true)}
8686
placeholder="Enter search term"
8787
/>
8888
{isOpen && (isLoading || results.length > 0) && (
@@ -95,7 +95,7 @@ function AutoCompleteInput() {
9595
<div
9696
onClick={() => {
9797
setQuery(result.title);
98-
setIsOpen(false);
98+
setOpen(false);
9999
}}
100100
>
101101
{result.title}

src/docs/ko/intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ right-title="with-react-simplikit.tsx">
3838
<template #left>
3939

4040
```tsx
41-
// without react simplikit
41+
// `react-simplikit`을 사용하지 않은 코드
4242
const texts = ['hello', 'react', 'world'];
4343

4444
function Page() {
@@ -61,7 +61,7 @@ function Page() {
6161
<template #right>
6262

6363
```tsx
64-
// with react simplikit
64+
// `react-simplikit`을 사용한 코드
6565
const texts = ['hello', 'react', 'world'];
6666

6767
function Page() {
@@ -87,7 +87,7 @@ function Page() {
8787
```tsx
8888
function Page() {
8989
// useIntersectionObserver는 intersection을 감지하는 최소한의 기능을 제공하고,
90-
// 감지 후 콜백, intersection 옵션은 외부로부터 주입 받습니다.
90+
// 감지 후, 콜백과 intersection 옵션은 외부로부터 주입받아요.
9191
const ref = useIntersectionObserver<HTMLDivElement>(
9292
entry => {
9393
if (entry.isIntersecting) {

src/docs/ko/why-react-simplikit-matters.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
function AutoCompleteInput() {
2525
const [query, setQuery] = useState('');
2626
const [results, setResults] = useState<SearchResult[]>([]);
27-
const [isLoading, setIsLoading] = useState(false);
28-
const [isOpen, setIsOpen] = useState(false);
27+
const [isLoading, setLoading] = useState(false);
28+
const [isOpen, setOpen] = useState(false);
2929
const searchTimeoutRef = useRef<NodeJS.Timeout>(null);
3030
const containerRef = useRef<HTMLDivElement>(null);
3131

@@ -35,7 +35,7 @@ function AutoCompleteInput() {
3535
containerRef.current &&
3636
!containerRef.current.contains(e.target as Node)
3737
) {
38-
setIsOpen(false);
38+
setOpen(false);
3939
}
4040
};
4141

@@ -53,7 +53,7 @@ function AutoCompleteInput() {
5353
return;
5454
}
5555

56-
setIsLoading(true);
56+
setLoading(true);
5757
searchTimeoutRef.current = setTimeout(async () => {
5858
try {
5959
const response = await fetch(`/api/search?q=${query}`);
@@ -62,7 +62,7 @@ function AutoCompleteInput() {
6262
} catch (error) {
6363
console.error('Failed to fetch results:', error);
6464
} finally {
65-
setIsLoading(false);
65+
setLoading(false);
6666
}
6767
}, 300);
6868

@@ -80,9 +80,9 @@ function AutoCompleteInput() {
8080
value={query}
8181
onChange={e => {
8282
setQuery(e.target.value);
83-
setIsOpen(true);
83+
setOpen(true);
8484
}}
85-
onFocus={() => setIsOpen(true)}
85+
onFocus={() => setOpen(true)}
8686
placeholder="검색어를 입력하세요"
8787
/>
8888
{isOpen && (isLoading || results.length > 0) && (
@@ -95,7 +95,7 @@ function AutoCompleteInput() {
9595
<div
9696
onClick={() => {
9797
setQuery(result.title);
98-
setIsOpen(false);
98+
setOpen(false);
9999
}}
100100
>
101101
{result.title}

0 commit comments

Comments
 (0)