Skip to content

Lesson 1 4 - #6

Open
badgerbadgers wants to merge 3 commits into
mainfrom
lesson-1-4
Open

Lesson 1 4#6
badgerbadgers wants to merge 3 commits into
mainfrom
lesson-1-4

Conversation

@badgerbadgers

Copy link
Copy Markdown
Owner

Submission of code for lesson-1-4.

@esthicodes esthicodes left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, why did you add a semicolon?
Both cases should work with and without semicolon. You can write your entire React.js code without using semicolons. There are a few exceptions that rely on it, like a for loop. JavaScript also has Automatic Semicolon Insertion which interprets semicolons in places where they are critical and could break code. So it's totally up to you to use them or not. The only benefit might be readability.

@esthicodes esthicodes left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!
Hard Work always pays off 👍🏻

Comment thread src/AddTodoForm.js
*/
function handleTitleChange(event) {
let newTodoTitle = event.target.value
let newTodoTitle = event.target.value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

did you find out when to use the semicolon (;)?

Use semi-colons at the end of return statements: This is especially helpful within the context of JS frameworks like react where a return statement can take up the whole function. It helps spot the difference between when the function logic ends and when the actual function ends.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I will use semicolon only at the end of a statement from now on. It is a hold over from writing JS code with frequent use of semicolon. In some React code I've seen I had seen frequent semicolon use also. For example after import files at or exporting the default component.

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