Skip to content

#116 07 form update dependencies #122

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

Merged
merged 22 commits into from
May 7, 2018

Conversation

carlostxm
Copy link
Collaborator

Updating dependencies.

It was needed to refactor the App due to the changes in react-router.

  • component moved to react-router-dom
  • Nesting routes are not allowed in react-router v4 so router.tsx was refactored using
  • hashHistory is removed in v4, so Router was changed by which contains history.

For more details check @arp82 comment in #116.

@brauliodiez brauliodiez requested a review from arp82 November 9, 2017 17:36
constructor() {
super();
interface Props {
history: PropTypes.object.isRequired;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is OK, it is using the default React typing from prop-types library. I wonder though if there would be a better way to do this. @brauliodiez, any suggestions?

Copy link
Member

Choose a reason for hiding this comment

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

For type history you have to:

import { History } from 'history';
...
interface Props {
  history: History;
}

Copy link
Member

@brauliodiez brauliodiez Nov 15, 2017

Choose a reason for hiding this comment

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

Since is typescript we should not use prop-types, just interface

Copy link
Collaborator

@arp82 arp82 left a comment

Choose a reason for hiding this comment

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

Good job!

@carlostxm carlostxm closed this Nov 13, 2017
@carlostxm carlostxm reopened this Nov 13, 2017
"react-router": "^3.0.5",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-router": "^4.2.0",
Copy link
Member

Choose a reason for hiding this comment

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

react-router is not necessary because it's the core. I mean, react-router is used in react-router-dom

"@types/react-router": "^3.0.11",
"@types/react": "^16.0.20",
"@types/react-dom": "^16.0.2",
"@types/react-router": "^4.0.16",
Copy link
Member

Choose a reason for hiding this comment

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

Remove too

@@ -109,21 +109,25 @@ export * from './members';
### ./src/router.tsx
```diff
import * as React from 'react';
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
import { Route, Switch } from 'react-router';
Copy link
Member

@nasdan nasdan Nov 15, 2017

Choose a reason for hiding this comment

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

Use imports from react-router-dom

@@ -50,8 +54,8 @@ export class MemberPageContainer extends React.Component<{}, State> {
<MemberPage
member={this.state.member}
onChange={this.onFieldValueChange}
onSave={this.onSave}
onSave={this.onSave(this.props)}
Copy link
Member

Choose a reason for hiding this comment

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

not necessary passing props as argument because the onSave method is define inside class.

You could:

private onSave = () => {
  ....
  this.props.history.goback();
....
}

@@ -1,17 +1,21 @@
import * as React from 'react';
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
import { Route, Switch } from 'react-router';
Copy link
Member

Choose a reason for hiding this comment

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

Use imports from react-router-dom

@nasdan
Copy link
Member

nasdan commented Nov 15, 2017

There is a typings error in ./src/components/members/page.tsx pending to pass:

...
-  constructor() {
+  constructor(props) {
-    super();
+    super(props);
}
...

@carlostxm
Copy link
Collaborator Author

@nasdan, thank your for your comments!

Copy link
Collaborator

@arp82 arp82 left a comment

Choose a reason for hiding this comment

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

Seems like you covered everything from Nasdan's review. Good job!

Copy link
Collaborator

@arp82 arp82 left a comment

Choose a reason for hiding this comment

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

I think you missed the reference to react-router in line 396 of readme.md. Should it not be react-router-dom instead?

@carlostxm
Copy link
Collaborator Author

You're right @arp82, thanks. I've just updated the readme. This is the last issue opened, if there is not more issues to fix in this PR, please @nasdan @brauliodiez merge and close this inifinite issue :)

@brauliodiez brauliodiez merged commit c116d96 into Lemoncode:master May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants