-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Refactor Sum component and update App to use it; enhance editor setti… #4050
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
65e3300
e6f44fe
e19076c
6957349
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,16 @@ | ||
| { | ||
| "arrowParens": "avoid", | ||
| "singleQuote": true, | ||
| "tabWidth": 2, | ||
| "trailingComma": "all", | ||
| "jsxSingleQuote": false, | ||
| "printWidth": 80, | ||
| "semi": true, | ||
| "bracketSpacing": true, | ||
| "bracketSameLine": false | ||
| "files.autoSave": "afterDelay", | ||
| "files.autoSaveDelay": 500, | ||
| "editor.fontSize": 15, | ||
| "editor.tabSize": 2, | ||
| "editor.renderWhitespace": "boundary", | ||
| "editor.detectIndentation": false, | ||
|
|
||
| "editor.codeActionsOnSave": { | ||
| "source.fixAll": "always", | ||
| "source.fixAll.eslint": "always" | ||
| }, | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode", | ||
| "editor.formatOnType": true, | ||
| "editor.formatOnSave": true | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import React from 'react'; | ||
| import './App.scss'; | ||
| import React from "react"; | ||
| import "./App.scss"; | ||
| import { Sum } from "./components/Sum/Sum"; | ||
|
|
||
| export const App = () => ( | ||
| <> | ||
|
|
@@ -8,7 +9,10 @@ export const App = () => ( | |
| <p>Sum of 10 and 0 is 10</p> | ||
| <p>Sum of 0 and 5 is 5</p> | ||
| <p>Sum of 0 and 0 is 0</p> | ||
| {/* Replace paragraphs with Sum componets */} | ||
| {/* And remove commented lines :) */} | ||
| <Sum a={2} b={3} /> | ||
| <Sum a={-5} b={5} /> | ||
| <Sum a={10} b={0} /> | ||
| <Sum a={0} b={5} /> | ||
|
||
| <Sum a={0} b={0} /> | ||
|
||
| </> | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,7 @@ | ||
| // export const Sum = () => (); | ||
| export const Sum = ({ a = 0, b = 0 }) => { | ||
| return ( | ||
| <p> | ||
| Sum of {a} and {b} is {a + b} | ||
|
||
| </p> | ||
| ); | ||
| }; | ||
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.
According to the requirements, you should only pass the
aprop here. This is to test whether thebprop correctly defaults to0when it's not provided.