Merged
Conversation
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
commented
May 13, 2020
| _onAddTodo = () => { | ||
| if(this.refs.todo.value.length > 0) { | ||
| this.props.handleAddTodo(this.refs.todo.value); | ||
| this.refs.todo.value = ''; |
Contributor
Author
There was a problem hiding this comment.
using references to the dom is a bad practice, better use form.reset(); 😉
jdrouet
commented
May 13, 2020
| request('post', '/api/todos', {text:value}) | ||
| .then((response) => { | ||
| let todosCopy = this.state.todos; | ||
| todosCopy.unshift({text:value}); |
Contributor
Author
There was a problem hiding this comment.
here we are mutating an element of the state (not a copy) which is something we shouldn't do with react
jdrouet
commented
May 13, 2020
Contributor
Author
jdrouet
left a comment
There was a problem hiding this comment.
some information about the changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
constinstead ofvar