Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8ac20f4
test
timothypark33 Dec 7, 2021
8362514
Click Me! 구현
timothypark33 Dec 7, 2021
95d78dd
메인버튼 숫자버튼 나워서 구현 및 counter 구현완료
timothypark33 Dec 7, 2021
e1f0490
테스트 통과를 위한 버튼 text 수정
timothypark33 Dec 7, 2021
dcd95f3
[chore] single quote
timothypark33 Dec 8, 2021
c8c1e3d
[chore] numbers 풀네임 사용
timothypark33 Dec 8, 2021
372b339
App을 컴포넌트로 분리
timothypark33 Dec 8, 2021
37af430
[chore] Page를 컴포넌트로 분리
timothypark33 Dec 8, 2021
60eb456
[chore]App을 컴포넌트로 분리
timothypark33 Dec 8, 2021
a225562
[chore] Page을 컴포넌트로 분리
timothypark33 Dec 8, 2021
4f53391
[chore] MainClick을 컴포넌트로 분리
timothypark33 Dec 8, 2021
7fd375f
[chore] Buttons을 컴포넌트로 분리
timothypark33 Dec 8, 2021
96d884b
[chore] NumberButton을 컴포넌트로 분리
timothypark33 Dec 8, 2021
b9a0a97
Merge branch 'main' of https://github.com/GUAJEGUICHAN/react-week2-as…
timothypark33 Dec 8, 2021
1b2d104
[chore] .eslintrc.js 변경
timothypark33 Dec 9, 2021
9062fb3
[chore] package.json업데이트
timothypark33 Dec 9, 2021
40b2085
[chore] 의미가 구분된 import들 빈줄 넣기
timothypark33 Dec 9, 2021
7294e13
[fix] state 업데이트 시 기존의 상태를 포함시키기
timothypark33 Dec 9, 2021
1977185
[refactor] MainButton을 안쓰고 NumberButton을 재활용하 수 있도록 변형
timothypark33 Dec 9, 2021
c1c0b5a
[refactor] MainClick대신 NumberButton 사용
timothypark33 Dec 9, 2021
36e1cd5
[refactor] MainClick 제거
timothypark33 Dec 9, 2021
969e7e3
[fix] eslint 적용
timothypark33 Dec 9, 2021
939f042
[fix] eslint 적용
timothypark33 Dec 9, 2021
b8f9344
Merge branch 'main' of https://github.com/GUAJEGUICHAN/react-week2-as…
timothypark33 Dec 9, 2021
5c83873
[fix] eslint 에러 완전 해결
timothypark33 Dec 10, 2021
62a6807
[refactor] 컴포넌트 props 줄바꿈으로 가독성 향상
timothypark33 Dec 10, 2021
7af9417
[refactor] NumberButton 재사용성 향상
timothypark33 Dec 10, 2021
5922445
[refactor] 풀네임 사용
timothypark33 Dec 10, 2021
07d16e4
[fix] eslint 적용
timothypark33 Dec 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
},
extends: [
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'airbnb',
],
parserOptions: {
Expand All @@ -25,6 +26,17 @@ module.exports = {
Scenario: 'readonly',
},
rules: {
'react/function-component-definition': [2, {
namedComponents: 'function-declaration',
}],
'react/prop-types': 'off',
'react/jsx-no-bind': ['error', {
ignoreRefs: true,
allowArrowFunctions: true,
allowFunctions: false,
allowBind: false,
ignoreDOMComponents: true,
}],
indent: ['error', 2],
'no-trailing-spaces': 'error',
curly: 'error',
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
</head>

<body>
<div>Counter</div>
<div id="app"></div>
<script src="main.js"></script>
</body>

</html>
</html>
12,493 changes: 11,879 additions & 614 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"@codeceptjs/configure": "^0.6.2",
"babel-loader": "^8.2.2",
"codeceptjs": "^3.0.6",
"eslint": "^7.25.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint": "^8.4.1",
"eslint-config-airbnb": "^19.0.2",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"puppeteer": "^9.0.0",
"start-server-and-test": "^1.12.1",
"webpack": "^5.36.2",
Expand Down
24 changes: 24 additions & 0 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { useState } from 'react';

import Page from './Page';

export default function App() {
const [state, setState] = useState({
count: 0,
});
const { count } = state;

const handleClick = (number) => {
setState({
...state,
count: count + number,
});
};

return (
<Page
onClick={handleClick}
count={count}
/>
);
}
20 changes: 20 additions & 0 deletions src/components/Buttons.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';

import NumberButton from './NumberButton';

export default function Buttons({ onClick }) {
const numbers = [1, 2, 3, 4, 5];
return (
<div>
{numbers.map((i) => (
<NumberButton
key={i}
onClick={() => onClick(i)}
>
{i}
</NumberButton>
))}
</div>

);
}
12 changes: 12 additions & 0 deletions src/components/NumberButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

export default function NumberButton({ onClick, children }) {
return (
<button
onClick={onClick}
type="button"
>
{children}
</button>
);
}
20 changes: 20 additions & 0 deletions src/components/Page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';

import Buttons from './Buttons';
import NumberButton from './NumberButton';

export default function Page({ onClick, count }) {
return (
<div>
<NumberButton
onClick={() => onClick(1)}
number={1}
>
Click me (
{count}
)
</NumberButton>
<Buttons onClick={onClick} />
</div>
);
}
7 changes: 7 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

import ReactDOM from 'react-dom';

import App from './components/App';

ReactDOM.render(<App />, document.getElementById('app'));
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');

module.exports = {
mode: 'development',
entry: path.resolve(__dirname, 'src/index.jsx'),
module: {
rules: [
Expand Down