Commit 820c6a77 authored by Shen Chang's avatar Shen Chang

docs: Change README.md

parent 2151d78e
...@@ -146,6 +146,8 @@ Children of `<KeepAlive>` will be cached, but we have to make sure that `<KeepAl ...@@ -146,6 +146,8 @@ Children of `<KeepAlive>` will be cached, but we have to make sure that `<KeepAl
`disabled`: When we don't need components for caching, we can disable it; the disabled configuration will only takes effect when the component's status changes from unactive to active. `disabled`: When we don't need components for caching, we can disable it; the disabled configuration will only takes effect when the component's status changes from unactive to active.
**Note**: `<KeepAlive>` The innermost outer layer of the packaged component must have a real DOM tag.
#### Example #### Example
```JavaScript ```JavaScript
import React from 'react'; import React from 'react';
...@@ -164,6 +166,7 @@ import { ...@@ -164,6 +166,7 @@ import {
class One extends React.Component { class One extends React.Component {
render() { render() {
return ( return (
// a real DOM tag
<div>This is One.</div> <div>This is One.</div>
); );
} }
......
...@@ -148,6 +148,8 @@ npm install react-router@next react-router-dom@next ...@@ -148,6 +148,8 @@ npm install react-router@next react-router-dom@next
`disabled`:当我们不需要缓存组件时,我们可以禁用它;禁用仅在组件从未激活状态变为激活状态时生效。 `disabled`:当我们不需要缓存组件时,我们可以禁用它;禁用仅在组件从未激活状态变为激活状态时生效。
**注意**`<KeepAlive>` 包裹的组件内部最外层必须有一个真实的 DOM 标签。
#### 例子 #### 例子
```JavaScript ```JavaScript
......
{ {
"name": "react-keep-alive", "name": "react-keep-alive",
"version": "2.0.0-alpha.0", "version": "2.0.0",
"description": "Package will allow components to maintain their status, to avoid repeated re-rendering.", "description": "Package will allow components to maintain their status, to avoid repeated re-rendering.",
"author": "Shen Chang", "author": "Shen Chang",
"homepage": "https://github.com/Sam618/react-keep-alive", "homepage": "https://github.com/Sam618/react-keep-alive",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment