Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
awmleer authored Feb 2, 2021
2 parents 5056e2e + 078e2bb commit 4be8dc9
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 8 deletions.
41 changes: 41 additions & 0 deletions CONTRIBUTING.en-US.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing

> Refer to the ant design [Contributing](https://ant.design/docs/react/contributing)
The following is a set of guidelines for contributing to `ahooks`. Please spend several minutes reading these guidelines before you create an issue or pull request.

## Open Development

All work on ahooks happens directly on [GitHub](https://github.com/alibaba/hooks). Both core team members and external contributors send pull requests which go through the same review process.

## Branch Organization

we maintain two branches, master and feature. If you send a bugfix pull request, please do it against the master branch, if it's a feature pull request, please do it against the feature branch.

## New Features

If you want to add a new Hook,we recommend that you first create an issue that describes the application scenario and usage of the Hook, see [[RFC] useLockFn](https://github.com/alibaba/hooks/issues/562)

Then you can initialize a new Hook based on an existing Hook.

## Pull Request

We are monitoring for pull requests. We will review your pull request and either merge it, request changes to it, or close it with an explanation.

Before submitting a pull request, please make sure the following is done:

1. create your branch from the [correct branch](#Branch-Organization).

2. If you've fixed a bug or added code that should be tested, add tests!

3. Ensure the test suite passes `npm run test`

## Development Workflow

After cloning antd, run `npm install` to fetch its dependencies. Then, you can run several commands:

1. `npm start` runs `ahooks` website locally。

2. `npm run test` runs the complete test suite。

3. `npm run build` creates UMD build of `ahooks`
4 changes: 2 additions & 2 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ahooks",
"version": "2.9.4",
"version": "2.9.6",
"description": "react hooks library",
"keywords": [
"ahooks",
Expand Down Expand Up @@ -32,7 +32,7 @@
"README.md"
],
"dependencies": {
"@ahooksjs/use-request": "^2.8.1",
"@ahooksjs/use-request": "^2.8.3",
"@types/js-cookie": "^2.2.6",
"dayjs": "^1.9.1",
"intersection-observer": "^0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useCreation/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ group:

`useMemo` can't guarantee the memoized value will not be recalculated, while `useCreation` can guarantee that. As the the official document of React.js says:

> **You may rely on useMemo as a performance optimization, not as a semantic guarantee.**In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
> **You may rely on useMemo as a performance optimization, not as a semantic guarantee.** In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
And similar to `useRef`, you can use `useCreation` to create some constants. But `useCreation` can avoid performance hazards.

Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useCreation/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ group:

因为 `useMemo` 不能保证被 memo 的值一定不会被重计算,而 `useCreation` 可以保证这一点。以下为 React 官方文档中的介绍:

> **You may rely on useMemo as a performance optimization, not as a semantic guarantee.**In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
> **You may rely on useMemo as a performance optimization, not as a semantic guarantee.** In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without `useMemo` — and then add it to optimize performance.
而相比于 `useRef`,你可以使用 `useCreation` 创建一些常量,这些常量和 `useRef` 创建出来的 ref 有很多使用场景上的相似,但对于复杂常量的创建,`useRef` 却容易出现潜在的性能隐患。

Expand Down
4 changes: 2 additions & 2 deletions packages/hooks/src/useDocumentVisibility/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ A Hook can tell if the page is visible.
## API

```typescript
const documentVisibility = useDocumentVisibility();
const documentVisibility = useDocumentVisibility();
```

### Result
| Property | Description | Type |
|---------|----------------------------------------------|------------------------|
| documentVisibility | Determine if the document is visible | `visible`\| `hidden` \| `prerender` \| `undefined` |
| documentVisibility | Determine if the document is visible | `visible`\| `hidden` \| `prerender` \| `undefined` |
2 changes: 1 addition & 1 deletion packages/use-request/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ahooksjs/use-request",
"version": "2.8.1",
"version": "2.8.3",
"description": "React Hooks for fetching, caching and updating asynchronous data",
"main": "./lib/index.js",
"module": "./es/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/use-url-state/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ahooksjs/use-url-state",
"version": "2.5.3",
"version": "2.5.5",
"description": "A hook that stores the state into url query parameters.",
"main": "./lib/index.js",
"module": "./es/index.js",
Expand Down

0 comments on commit 4be8dc9

Please sign in to comment.