Skip to content

Commit 5509b61

Browse files
author
Vlad Balin
committed
Update BackboneViews.md
1 parent e579090 commit 5509b61

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

docs/BackboneViews.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,11 @@ Therefore, it might be required to remove some items from the View's model.
102102

103103
I will assume we're using EJS to be specific. JSX is not text, it's hidden JS tree construction expression, thus control structures must be transformed to functional form. In short, branches becomes logical expressions, loops becomes `map` expressions. Expression must return single node or array, in the last case you're required to add `key` attribute. Component must return single node at the top level.
104104

105-
`class` should be substitued with `className`
106-
`<%= expr %>` -> `{ expr }`
107-
108-
`<%if( expr ){%> <div/> <%}%>` -> `{ expr && <div/> }`
109-
110-
`<%if( expr ){%> <div/> <%}else{%> <span/> <%}%>` -> `{ expr ? <div/> : <span/> }`
111-
112-
`<%for( var i = 0; i < arr.length; i++ ){%> <div/> <%}%>` -> `{ arr.map( ( x, i ) => <div key={ i } /> )}`
105+
- `class` should be substitued with `className`
106+
- `<%= expr %>` -> `{ expr }`
107+
- `<%if( expr ){%> <div/> <%}%>` -> `{ expr && <div/> }`
108+
- `<%if( expr ){%> <div/> <%}else{%> <span/> <%}%>` -> `{ expr ? <div/> : <span/> }`
109+
- `<%for( var i = 0; i < arr.length; i++ ){%> <div/> <%}%>` -> `{ arr.map( ( x, i ) => <div key={ i } /> )}`
113110

114111
### Use Existing Model as component's state
115112

0 commit comments

Comments
 (0)