Skip to content

Update React #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"ansi": "^0.3.0",
"babel-core": "^6.5.2",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.5.2",
"cross-env": "^3.1.4",
"dot": "^1.0.3",
Expand All @@ -32,8 +32,8 @@
"pug": "^2.0.0-alpha6",
"raptor-async": "^1.1.2",
"raptor-polyfill": "^1.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"swig": "^1.4.2",
"uglify-js": "^3.0.0",
"vue": "^2.0.1",
Expand Down
12 changes: 6 additions & 6 deletions templates/simple-1/template.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
'use strict';
var React = require('react');

function renderColor(color) {
const renderColor = (color) => {React.memo((color) => {
var style = {
backgroundColor: color
};

return <li className="color" style={style}>
{color}
</li>
}
})};

function renderColors(colors) {
const renderColors = (colors) => {React.memo((colors) => {
if (colors.length) {
return (<ul>{colors.map(renderColor)}</ul>);
} else {
return <div>No colors!</div>
}
}
})};

module.exports = React.createClass({
module.exports = class extends React.PureComponent {
render() {
var style = {backgroundColor: 'blue', border: '1px solid black'};

Expand All @@ -31,4 +31,4 @@ module.exports = React.createClass({
<button type="button" className="{this.props.primary ? 'primary' : 'secondary'}">Click me!</button>
</div>;
}
});
};
12 changes: 6 additions & 6 deletions templates/ui-components/components/ReactColors.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
'use strict';
var React = require('react');

function renderColor(color) {
const renderColor = (color) => {React.memo((color) => {
var style = {
backgroundColor: color
};

return <li className="color" style={style}>
{color}
</li>
}
})};

function renderColors(colors) {
const renderColors = (colors) => {React.memo((colors) => {
if (colors.length) {
return (<ul>{colors.map(renderColor)}</ul>);
} else {
return <div>No colors!</div>
}
}
})};

module.exports = class extends React.Component {
module.exports = class extends React.PureComponent {
componentDidMount() {
console.log('Mounted!')
}
Expand All @@ -30,4 +30,4 @@ module.exports = class extends React.Component {
{renderColors(this.props.colors)}
</div>;
}
};
};
4 changes: 2 additions & 2 deletions templates/ui-components/template.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var React = require('react');
var Colors = require('./components/ReactColors.jsx');

module.exports = module.exports = React.createClass({
module.exports = class extends React.PureComponent {
render() {
return <div className="my-app">
<Colors colors={this.props.colors} name={this.props.name}/>
</div>;
}
});
};