Corrected the case issue of 'JavaScript' throughout the docs (#2401)
* corrected JavaScript spelling
This commit is contained in:
parent
44fac6c4ca
commit
982fdf5737
21 changed files with 72 additions and 72 deletions
12
docs/jsx.md
12
docs/jsx.md
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
### Description
|
||||
|
||||
JSX is a syntax extension that enables you to write HTML tags interspersed with Javascript. It's not part of any Javascript standards and it's not required for building applications, but it may be more pleasing to use depending on your team's preferences.
|
||||
JSX is a syntax extension that enables you to write HTML tags interspersed with JavaScript. It's not part of any JavaScript standards and it's not required for building applications, but it may be more pleasing to use depending on your team's preferences.
|
||||
|
||||
```jsx
|
||||
var MyComponent = {
|
||||
|
|
@ -33,7 +33,7 @@ var MyComponent = {
|
|||
}
|
||||
```
|
||||
|
||||
When using JSX, it's possible to interpolate Javascript expressions within JSX tags by using curly braces:
|
||||
When using JSX, it's possible to interpolate JavaScript expressions within JSX tags by using curly braces:
|
||||
|
||||
```jsx
|
||||
var greeting = "Hello"
|
||||
|
|
@ -186,14 +186,14 @@ JSX is essentially a trade-off: it introduces a non-standard syntax that cannot
|
|||
|
||||
Unlike HTML, JSX is case-sensitive. This means `<div className="test"></div>` is different from `<div classname="test"></div>` (all lower case). The former compiles to `m("div", {className: "test"})` and the latter compiles to `m("div", {classname: "test"})`, which is not a valid way of creating a class attribute. Fortunately, Mithril supports standard HTML attribute names, and thus, this example can be written like regular HTML: `<div class="test"></div>`.
|
||||
|
||||
JSX is useful for teams where HTML is primarily written by someone without Javascript experience, but it requires a significant amount of tooling to maintain (whereas plain HTML can, for the most part, simply be opened in a browser)
|
||||
JSX is useful for teams where HTML is primarily written by someone without JavaScript experience, but it requires a significant amount of tooling to maintain (whereas plain HTML can, for the most part, simply be opened in a browser)
|
||||
|
||||
Hyperscript is the compiled representation of JSX. It's designed to be readable and can also be used as-is, instead of JSX (as is done in most of the documentation). Hyperscript tends to be terser than JSX for a couple of reasons:
|
||||
|
||||
- it does not require repeating the tag name in closing tags (e.g. `m("div")` vs `<div></div>`)
|
||||
- static attributes can be written using CSS selector syntax (i.e. `m("a.button")` vs `<a class="button"></a>`)
|
||||
|
||||
In addition, since hyperscript is plain Javascript, it's often more natural to indent than JSX:
|
||||
In addition, since hyperscript is plain JavaScript, it's often more natural to indent than JSX:
|
||||
|
||||
```jsx
|
||||
//JSX
|
||||
|
|
@ -239,9 +239,9 @@ var BigComponent = {
|
|||
}
|
||||
```
|
||||
|
||||
In non-trivial applications, it's possible for components to have more control flow and component configuration code than markup, making a Javascript-first approach more readable than an HTML-first approach.
|
||||
In non-trivial applications, it's possible for components to have more control flow and component configuration code than markup, making a JavaScript-first approach more readable than an HTML-first approach.
|
||||
|
||||
Needless to say, since hyperscript is pure Javascript, there's no need to run a compilation step to produce runnable code.
|
||||
Needless to say, since hyperscript is pure JavaScript, there's no need to run a compilation step to produce runnable code.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue