Skip to content

Commit c33002a

Browse files
committed
update: --
1 parent af8d2f0 commit c33002a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
- [context](./react/context.md)
259259
- [concurrent-mode](./react/concurrent-mode.md)
260260
- [Hooks](./react/Hooks.md)
261+
- [Others](./react/Others.md)
261262

262263

263264
## 常见问题及解答

react/Others.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
```js
2+
import isValidElementType from 'shared/isValidElementType';
3+
import warningWithoutStack from 'shared/warningWithoutStack';
4+
5+
export default function memo<Props> (
6+
type: React$ElementType,
7+
compare?: (oldProps: Props, newProps: Props) => boolean,
8+
) {
9+
if(__DEV__) {}
10+
return {
11+
$$typeof: REACT_MEMO_TYPE,
12+
type,
13+
compare: compare === undefined ? null : compare,
14+
}
15+
}
16+
17+
// Fragment: REACT_FRAGMENT_TYPE
18+
// StrictMode: REACT_STRICT_MODE_TYPE
19+
// ReactElement
20+
```

0 commit comments

Comments
 (0)