Skip to content

Commit

Permalink
docs: add since tag
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiboss committed Sep 3, 2024
1 parent edc568c commit 7bf7e7c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/react-use/src/use-form/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HooksType, Since } from '@/components'

<HooksType {...frontmatter} />

<Since version="1.7.0" />
<Since version="v1.7.0" />

A React Hook for managing form state.

Expand Down
2 changes: 2 additions & 0 deletions packages/react-use/src/use-form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export interface UseFormReturns<FormState extends object> {
* A React Hook to manage form state with ease
*
* @param {UseFormOptions} options Options to customize the form behavior
*
* @since 1.7.0
*/
export function useForm<FormState extends object>(options: UseFormOptions<FormState> = {}): UseFormReturns<FormState> {
const {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-use/src/use-form/index.zh-cn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HooksType, Since } from '@/components'

<HooksType {...frontmatter} />

<Since version="1.7.0" />
<Since version="v1.7.0" />

一个用来管理表单状态的 React Hook。

Expand Down
5 changes: 5 additions & 0 deletions packages/react-use/src/use-virtual-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ export type UseVirtualListReturns<D> = readonly [
UseVirtualListReturnsActions,
]

/**
* A React Hook that helps to render large lists (known as **Virtual List**) more efficiently by rendering only the items that are visible to the user, supporting dynamic heights, horizontal and vertical scrolling, and more.
*
* @since 1.6.0
*/
export function useVirtualList<D = any>(list: D[], options: UseVirtualListOptions<D>): UseVirtualListReturns<D> {
const overscanCount = options.overscan ?? 5
const isVerticalLayout = 'itemHeight' in options
Expand Down
4 changes: 3 additions & 1 deletion packages/react-use/src/use-web-socket/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ features: ['Pausable']

# useWebSocket

import { HooksType } from '@/components'
import { HooksType, Since } from '@/components'

<HooksType {...frontmatter} />

<Since version="v1.7.0" />

A simplified React Hook for using WebSocket, which is a wrapper around the native WebSocket API, supporting error retries, heartbeat checks, timeout reconnections, and more.

## Scenes \{#scenes}
Expand Down
5 changes: 5 additions & 0 deletions packages/react-use/src/use-web-socket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export type UseWebSocketReturnsReadyState =

const defaultHeartbeatMessage = 'ping'

/**
* A simplified React Hook for using WebSocket, which is a wrapper around the native WebSocket API, supporting error retries, heartbeat checks, timeout reconnections, and more.
*
* @since 1.7.0
*/
export function useWebSocket(wsUrl?: string, options?: UseWebSocketOptions): UseWebSocketReturns<true>
export function useWebSocket(options?: Omit<UseWebSocketOptions, 'immediate'>): UseWebSocketReturns<false>
export function useWebSocket(
Expand Down
4 changes: 3 additions & 1 deletion packages/react-use/src/use-web-socket/index.zh-cn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ features: ['Pausable']

# useWebSocket

import { HooksType } from '@/components'
import { HooksType, Since } from '@/components'

<HooksType {...frontmatter} />

<Since version="v1.7.0" />

一个简化 WebSocket 使用的 React Hook,是原生 WebSocket API 的包装,支持自动重连、心跳检测等。

## 场景 \{#scenes}
Expand Down

0 comments on commit 7bf7e7c

Please sign in to comment.