Closed16

React Foundations をやってみる

りょたりょた

1章

React is a JavaScript library for building interactive user interfaces.

React とはコレ。

りょたりょた

2章

What is the DOM?
The DOM is an object representation of the HTML elements. It acts as a bridge between your code and the user interface, and has a tree-like structure with parent and child relationships.

DOMとはコレ。

りょたりょた

命令型プログラミングと宣言型プログラミング

The code above is a good example of imperative programming. You're writing the steps for how the user interface should be updated. But when it comes to building user interfaces, a declarative approach is often preferred because it can speed up the development process. Instead of having to write DOM methods, it would be helpful if developers were able to declare what they want to show (in this case, an h1 tag with some text).

これがReactの良さ。結果ベースで実装できる。
デメリットとしては、DOMの操作の箇所が中のソースを見ない限りわからない、という点。

このページもわかりやすい。
https://react.dev/learn/reacting-to-input-with-state

りょたりょた

4章

りょたりょた

そのままではブラウザはjsxを認識できないため、コンパイラが必要。今回はbabel

りょたりょた

5章

りょたりょた

First, React components should be capitalized to distinguish them from plain HTML and JavaScript:

コンポーネント名がアッパーキャメルである理由

このスクラップは2024/02/25にクローズされました