Skip to content

React mongo cleanup#63

Merged
glours merged 3 commits intodocker:masterfrom
jdrouet:react-mongo-cleanup
May 13, 2020
Merged

React mongo cleanup#63
glours merged 3 commits intodocker:masterfrom
jdrouet:react-mongo-cleanup

Conversation

@jdrouet
Copy link
Contributor

@jdrouet jdrouet commented May 12, 2020

  • rename server to backend
  • remove state mutation in frontend
  • remove port specification in dockerfiles (port binding is made for that)
  • use const instead of var
  • apply prettier on files to keep style consistent

jdrouet added 3 commits May 12, 2020 15:24
The goal here is to keep the same structure than the other examples.
Also, considering that it has a "frontend" folder, the equivalent for
the server should be "backend".

Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
to fix some syntax issues in the existing code, the commit
put in place prettier and format the code

Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
- apply prettier style on every js file
- remove mutation on immutable variables
- remove wrapper on top of axios
- fix form handling
- remove useless port definition in dockerfile

Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
@jdrouet jdrouet changed the title [WIP] React mongo cleanup React mongo cleanup May 13, 2020
@jdrouet jdrouet requested a review from glours May 13, 2020 07:47
_onAddTodo = () => {
if(this.refs.todo.value.length > 0) {
this.props.handleAddTodo(this.refs.todo.value);
this.refs.todo.value = '';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using references to the dom is a bad practice, better use form.reset(); 😉

request('post', '/api/todos', {text:value})
.then((response) => {
let todosCopy = this.state.todos;
todosCopy.unshift({text:value});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

here we are mutating an element of the state (not a copy) which is something we shouldn't do with react

Copy link
Contributor Author

@jdrouet jdrouet left a comment

Choose a reason for hiding this comment

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

some information about the changes

Copy link
Collaborator

@glours glours left a comment

Choose a reason for hiding this comment

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

LGTM

@glours glours merged commit e5828ad into docker:master May 13, 2020
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.

2 participants