-
Notifications
You must be signed in to change notification settings - Fork 392
#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
#116 07 form update dependencies #122
Conversation
constructor() { | ||
super(); | ||
interface Props { | ||
history: PropTypes.object.isRequired; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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;
}
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
07 Form/package.json
Outdated
"react-router": "^3.0.5", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0", | ||
"react-router": "^4.2.0", |
There was a problem hiding this comment.
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
07 Form/package.json
Outdated
"@types/react-router": "^3.0.11", | ||
"@types/react": "^16.0.20", | ||
"@types/react-dom": "^16.0.2", | ||
"@types/react-router": "^4.0.16", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove too
07 Form/readme.md
Outdated
@@ -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'; |
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
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();
....
}
07 Form/src/router.tsx
Outdated
@@ -1,17 +1,21 @@ | |||
import * as React from 'react'; | |||
import { Router, Route, IndexRoute, hashHistory } from 'react-router'; | |||
import { Route, Switch } from 'react-router'; |
There was a problem hiding this comment.
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
There is a ...
- constructor() {
+ constructor(props) {
- super();
+ super(props);
}
... |
@nasdan, thank your for your comments! |
There was a problem hiding this 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!
There was a problem hiding this 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?
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 :) |
Updating dependencies.
It was needed to refactor the App due to the changes in react-router.
For more details check @arp82 comment in #116.