Skip to content

Commit

Permalink
Merge pull request #185 from madogiwa0124/fixed-tiny-typo-for-minimum…
Browse files Browse the repository at this point in the history
…-virtual-dom

Fixed a tiny typo in Minimum Virtual DOM.
  • Loading branch information
Ubugeeei committed Dec 17, 2023
2 parents ed1835f + 0ae3a1c commit e7bd1ab
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function h(
}
```

ここからが本筋なのですが、これまで VNode が持つ小要素の型は`(Vnode | string)[]`としてきたのですが、Text を文字列として扱い続けるのもなんなので、VNode に統一してみようと思います。
ここからが本筋なのですが、これまで VNode が持つ子要素の型は`(Vnode | string)[]`としてきたのですが、Text を文字列として扱い続けるのもなんなので、VNode に統一してみようと思います。
Text も実際にはただの文字列ではなく、HTML の TextElement として存在するので、文字列以上の情報を含みます。それらの周辺情報を扱うためにも VNode として扱いたいわけです。
具体的には、Text と言う Symbol を用いて、VNode の type として持たせましょう。
例えば、`"hello"`のようなテキストがあった時、
Expand Down

0 comments on commit e7bd1ab

Please sign in to comment.