Skip to content

Commit e3ce436

Browse files
committed
Remove declaration in render method and move it outside the component
1 parent 0050e58 commit e3ce436

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,48 +36,49 @@ import React, { Component } from 'react';
3636
import { View } from 'react-native';
3737
import MultiSelect from 'react-native-multiple-select';
3838

39-
class MultiSelectExample extends Component {
40-
41-
state = {
42-
selectedItems : [];
43-
};
44-
45-
46-
onSelectedItemsChange = selectedItems => {
47-
this.setState({ selectedItems });
48-
};
49-
50-
render() {
51-
const { selectedItems } = this.state;
52-
53-
const items = [{
39+
const items = [{
5440
id: '92iijs7yta',
55-
name: 'Ondo',
41+
name: 'Ondo'
5642
}, {
5743
id: 'a0s0a8ssbsd',
58-
name: 'Ogun',
44+
name: 'Ogun'
5945
}, {
6046
id: '16hbajsabsd',
61-
name: 'Calabar',
47+
name: 'Calabar'
6248
}, {
6349
id: 'nahs75a5sg',
64-
name: 'Lagos',
50+
name: 'Lagos'
6551
}, {
6652
id: '667atsas',
67-
name: 'Maiduguri',
53+
name: 'Maiduguri'
6854
}, {
6955
id: 'hsyasajs',
70-
name: 'Anambra',
56+
name: 'Anambra'
7157
}, {
7258
id: 'djsjudksjd',
73-
name: 'Benue',
59+
name: 'Benue'
7460
}, {
7561
id: 'sdhyaysdj',
76-
name: 'Kaduna',
62+
name: 'Kaduna'
7763
}, {
7864
id: 'suudydjsjd',
79-
name: 'Abuja',
80-
}];
65+
name: 'Abuja'
66+
}
67+
];
68+
69+
class MultiSelectExample extends Component {
70+
71+
state = {
72+
selectedItems : [];
73+
};
74+
75+
76+
onSelectedItemsChange = selectedItems => {
77+
this.setState({ selectedItems });
78+
};
79+
80+
render() {
81+
const { selectedItems } = this.state;
8182

8283
return (
8384
<View style={{ flex: 1 }}>

0 commit comments

Comments
 (0)