Skip to content

Commit 12c35d8

Browse files
committed
fix: missing children during patch
1 parent 4a7943f commit 12c35d8

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
# Tiny React
22

3+
A concise version of React **just good enough** for building uncomplicated ui, especially suitable for SDK care about the size deadly
4+
5+
<br>
6+
37
### Features
48
+ Basic JSX and Renderer with VirtualDOM(diff & patch)
5-
+ Function Component
6-
+ Hooks: `useState`
9+
+ Functional Component
10+
+ Hooks like `useState` / `useEffect`
11+
12+
<br>
13+
14+
### Todo
15+
- [ ] `useCallback` / `useMemo` ...
16+
- [ ] make state setter asynchronous
17+
18+
<br>
19+
20+
### My path to implement this React with Hooks
21+
1. [Who handled those JSX tags & What on earth JSX complied to be](void)
22+
2. []()
723

24+
<br>
825

9-
### TODO
10-
- [ ] `useEffect` / `useCallback` ...
26+
### Reference
27+
+ [《Gooact: React in 160 lines of JavaScript》](https://medium.com/@sweetpalma/gooact-react-in-160-lines-of-javascript-44e0742ad60f) by [Paul Marlow](https://github.com/sweetpalma)
28+
+ [《从零开始实现一个React》](https://github.com/hujiulong/blog/issues/4) by [Jiuling Hu](https://github.com/hujiulong)
29+
+ [《React hooks: not magic, just arrays》](https://medium.com/@ryardley/react-hooks-not-magic-just-arrays-cd4f1857236e) by [Rudi Yardley](https://github.com/ryardley)

src/vnode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function patch(
9595
]);
9696

9797
if (shouldComponentUpdate) {
98-
instance.props = Object.assign({}, instance.props, vnode.props);
98+
instance.props = Object.assign({}, instance.props, vnode.props, { children: vnode.children });
9999
setCurrentDispatcher(instance);
100100
const newVnode = instance._render(instance.renderFunc);
101101

0 commit comments

Comments
 (0)