Skip to content

Commit 40b7017

Browse files
ryankshawmichaelbrewerdavis
authored andcommitted
npx jscodeshift -t ../react-codemod/transforms/class.js src
1 parent fc50550 commit 40b7017

File tree

11 files changed

+193
-197
lines changed

11 files changed

+193
-197
lines changed

dist/react-tokeninput.js

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-tokeninput.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-tokeninput.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-tokeninput.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/main.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,26 @@ var without = require('lodash-node/modern/arrays/without')
77
var uniq = require('lodash-node/modern/arrays/uniq')
88
var names = require('./names')
99

10-
var App = React.createClass({
11-
getInitialState: function() {
12-
return {
13-
input: '',
14-
loading: false,
15-
selected: [],
16-
options: names
17-
};
18-
},
19-
20-
handleChange: function(value) {
10+
class App extends React.Component {
11+
state = {
12+
input: '',
13+
loading: false,
14+
selected: [],
15+
options: names
16+
};
17+
18+
handleChange = (value) => {
2119
this.setState({
2220
selected: value
2321
})
24-
},
22+
};
2523

26-
handleRemove: function(value) {
24+
handleRemove = (value) => {
2725
var selectedOptions = uniq(without(this.state.selected,value))
2826
this.handleChange(selectedOptions)
29-
},
27+
};
3028

31-
handleSelect: function(value, combobox) {
29+
handleSelect = (value, combobox) => {
3230
if(typeof value === 'string') {
3331
value = {id: value, name: value};
3432
}
@@ -40,9 +38,9 @@ var App = React.createClass({
4038
})
4139

4240
this.handleChange(selected)
43-
},
41+
};
4442

45-
handleInput: function(userInput) {
43+
handleInput = (userInput) => {
4644
this.setState({
4745
input: userInput,
4846
loading: true,
@@ -54,9 +52,9 @@ var App = React.createClass({
5452
loading: false
5553
})
5654
}.bind(this), 500)
57-
},
55+
};
5856

59-
filterTags: function(userInput) {
57+
filterTags = (userInput) => {
6058
if (userInput === '')
6159
return this.setState({options: []});
6260
var filter = new RegExp('^'+userInput, 'i');
@@ -70,9 +68,9 @@ var App = React.createClass({
7068
this.setState({
7169
options: filteredNames
7270
});
73-
},
71+
};
7472

75-
renderComboboxOptions: function() {
73+
renderComboboxOptions = () => {
7674
return this.state.options.map(function(name) {
7775
return (
7876
<ComboboxOption
@@ -82,9 +80,9 @@ var App = React.createClass({
8280
>{name.name}</ComboboxOption>
8381
);
8482
});
85-
},
83+
};
8684

87-
render: function() {
85+
render() {
8886
var selectedNames = this.state.selected.map(function(tag) {
8987
return <li key={tag.id}>{tag.name}</li>
9088
})
@@ -119,6 +117,6 @@ var App = React.createClass({
119117
</div>
120118
);
121119
}
122-
})
120+
}
123121

124122
ReactDOM.render(<App/>, document.getElementById('application'))

karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function(config) {
1313
cache: true,
1414
module: {
1515
loaders: [
16-
{ test: /\.js$/, loader: 'jsx-loader'}
16+
{ test: /\.js$/, loader: 'babel'}
1717
]
1818
}
1919
},

0 commit comments

Comments
 (0)