File tree 1 file changed +2
-35
lines changed 1 file changed +2
-35
lines changed Original file line number Diff line number Diff line change @@ -6,45 +6,12 @@ See [lightscript.org](http://lightscript.org) for example code
6
6
and language reference documentation. A quick taste:
7
7
8
8
``` coffee
9
- Item ({ item, isActive, onClick }) =>
9
+ Item ({ item, isActive }) =>
10
10
className = if isActive : ' active' else : ' inactive'
11
11
12
- <li onClick = {onClick} className = {className}>
12
+ <li className = {className}>
13
13
{item}
14
14
</li >
15
-
16
- class List extends React.Component :
17
-
18
- activateItem (itemId): void =>
19
- if this .state .activeItem == itemId :
20
- this .setState ({ activeItem : null })
21
- else :
22
- this .setState ({ activeItem : itemId })
23
-
24
- render () ->
25
- { items , activeItem } = this .state
26
-
27
- <div >
28
- {if activeItem :
29
- <p >You have selected : {activeItem}</p >
30
- else :
31
- <p >Click an item to select one! </p >
32
- }
33
-
34
- <ul >
35
- {items .map ((item , i ) =>
36
- isActive = activeItem == item .id
37
-
38
- if not item .hidden :
39
- <Item
40
- key = {i}
41
- item = {item}
42
- isActive = {isActive}
43
- onClick = {() => this .activateItem (item .id )}
44
- />
45
- )}
46
- </ul >
47
- </div >
48
15
```
49
16
50
17
Come hang out in [ the gitter chatroom] ( https://gitter.im/lightscript/Lobby ) , where contributors can help you get started and answer any questions.
You can’t perform that action at this time.
0 commit comments