@@ -361,7 +361,7 @@ code works identically to the previous example:
361
361
</div>
362
362
```
363
363
364
- If an element has * both * ` data-model ` and ` name ` attributes, the
364
+ If an element has _ both _ ` data-model ` and ` name ` attributes, the
365
365
` data-model ` attribute takes precedence.
366
366
367
367
## Loading States
@@ -1151,8 +1151,8 @@ Here are a few helpful things to know:
1151
1151
1152
1152
### Each component re-renders independent of one another
1153
1153
1154
- If a parent component re-renders, the child component will * not * (most
1155
- of the time) be updated, even though it lives inside the parent. Each
1154
+ If a parent component re-renders, the child component will _ not _ (most
1155
+ of the time) be updated, even though it lives inside the parent. Each
1156
1156
component is its own, isolated universe.
1157
1157
1158
1158
But... this is not always what you want. For example, suppose a
@@ -1171,9 +1171,9 @@ that it passes into the child:
1171
1171
```
1172
1172
1173
1173
In this situation, when the parent component re-renders after clicking
1174
- "Save", you * do * want the updated child component (with the validation
1175
- error) to be rendered. And, this * will * happen because the system detects
1176
- that the parent component has * changed * how it's rendering the child.
1174
+ "Save", you _ do _ want the updated child component (with the validation
1175
+ error) to be rendered. And, this _ will _ happen because the system detects
1176
+ that the parent component has _ changed _ how it's rendering the child.
1177
1177
1178
1178
This may not always be perfect, and if your child component has its own
1179
1179
` LiveProp ` that has changed since it was first rendered, that value will
@@ -1185,11 +1185,11 @@ Again, each component is its own, isolated universe! For example, suppose
1185
1185
your child component has:
1186
1186
1187
1187
``` html
1188
- <button data-action =" live#action" data-action-name =" save" >
1188
+ <button data-action =" live#action" data-action-name =" save" ></ button >
1189
1189
```
1190
1190
1191
1191
When the user clicks that button, it will attempt to call the ` save ` action
1192
- in the * child * component only, even if the ` save ` action actually only
1192
+ in the _ child _ component only, even if the ` save ` action actually only
1193
1193
exists in the parent. The same is true for ` data-model ` , though there is
1194
1194
some special handling for this case (see next point).
1195
1195
@@ -1201,23 +1201,23 @@ Suppose a child component has a:
1201
1201
<textarea data-model =" markdown_value" data-action =" live#update" >
1202
1202
```
1203
1203
1204
- When the user changes this field, this will * only * update the ` markdown_value `
1205
- field in the * child * component... because (yup, we're saying it again):
1204
+ When the user changes this field, this will _ only _ update the ` markdown_value `
1205
+ field in the _ child _ component... because (yup, we're saying it again):
1206
1206
each component is its own, isolated universe.
1207
1207
1208
1208
However, sometimes this isn't what you want! Sometimes, in addition
1209
- to updating the child component's model, you * also * want to update a
1210
- model on the * parent * component.
1209
+ to updating the child component's model, you _ also _ want to update a
1210
+ model on the _ parent _ component.
1211
1211
1212
1212
To help with this, whenever a model updates, a ` live:update-model `
1213
1213
is dispatched. All components automatically listen to this event. This
1214
1214
means that, when the ` markdown_value ` model is updated in the child
1215
- component, * if * the parent component * also * has a model called ` markdown_value `
1216
- it will * also * be updated. This is done as a "deferred" update
1215
+ component, _ if _ the parent component _ also _ has a model called ` markdown_value `
1216
+ it will _ also _ be updated. This is done as a "deferred" update
1217
1217
(i.e. [ updateDefer()] ( #deferring-a-re-render-until-later ) ).
1218
1218
1219
1219
If the model name in your child component (e.g. ` markdown_value ` ) is
1220
- * different * than the model name in your parent component (e.g. ` post.content ` ),
1220
+ _ different _ than the model name in your parent component (e.g. ` post.content ` ),
1221
1221
you can make sure both are set by leveraging both the ` data-model `
1222
1222
and ` name ` attributes:
1223
1223
@@ -1231,7 +1231,7 @@ and `name` attributes:
1231
1231
1232
1232
In this situation, the ` markdown_value ` model will be updated on the child
1233
1233
component (because ` data-model ` takes precedence over ` name ` ). But if
1234
- any parent components have a ` markdown_value ` model * or * a ` post.content `
1234
+ any parent components have a ` markdown_value ` model _ or _ a ` post.content `
1235
1235
model (normalized from ` post[content ` ] `), their model will also be updated.
1236
1236
1237
1237
### Full Embedded Component Example
@@ -1331,7 +1331,7 @@ In the `EditPostComponent` template, you render the `MarkdownTextareaComponent`:
1331
1331
```
1332
1332
1333
1333
Notice that ` MarkdownTextareaComponent ` allows a dynamic ` name ` attribute to
1334
- be passed in. This makes that component re-usable in any form. But it
1334
+ be passed in. This makes that component re-usable in any form. But it
1335
1335
also makes sure that when the ` textarea ` changes, both the ` value ` model
1336
- in ` MarkdownTextareaComponent ` * and * the ` post.content ` model in
1336
+ in ` MarkdownTextareaComponent ` _ and _ the ` post.content ` model in
1337
1337
` EditPostcomponent ` will be updated.
0 commit comments