Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Snap details to react #218

Merged
merged 10 commits into from
Apr 3, 2017
Merged

Snap details to react #218

merged 10 commits into from
Apr 3, 2017

Conversation

AlexandreAbreu
Copy link
Contributor

No description provided.

var Installer = require('../components/installer.js');

function SnapSize(props) {
var model = props.model;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the functional components.. it's not necessary, but a bit more explicit/nicer to destructure the props into arguments you actually use. So SnapSize({model}). After a bit of reading; I think it's safe to do <SnapSize {...model.attributes} /> and SnapSize({size}). Then the first two lines disappear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes makes total sense, and keeps things tight

Copy link

@dbarth dbarth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly stylistic nitpicking, otherwise nice implementation, with tests


module.exports = React.createBackboneClass({
componentWillMount: function() {
var model = this.props.model;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const ?

module.exports = React.createBackboneClass({
componentWillMount: function() {
var model = this.props.model;
if (! model) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would feel better to trap this above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well ... even if trapped above, ... I tend to be very paranoid in js ... there are not real guarantees at the component level that we can put to force a non null model ... which makes me uneasy about removing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified a bit the code for this

return;
}

var self = this;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover ?

},

onDownloadProgressChanged: function() {
var model = this.props.model;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same pattern, I would simplify at least with something like :
if (this.props.model)
this.setState(...)

},

render: function() {
var model = this.props.model;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

@dbarth dbarth merged commit d128d3a into snapcore:master Apr 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants