Skip to content

Commit 5babf5d

Browse files
committed
🐛: Function component is not a function declaration에러를 해결한다.
1 parent 9c8915c commit 5babf5d

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

front/.eslintrc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
}
2626
},
2727
"rules": {
28+
"react/function-component-definition": "off",
29+
// 이 함수형 컴포넌트를 어떤 함수 유형으로 사용할지 미리 정하고 rules에 명시해 두어야 에러가 발생하지 않는다. 따라서 그라운드 룰이 명확하지 않으면 사용하지 않는게 좋다.
2830
"react/react-in-jsx-scope": "off",
2931
"react/jsx-uses-react": "off",
3032
"linebreak-style": 0,
@@ -50,11 +52,11 @@
5052
"no-empty-pattern": 0,
5153
"no-alert": 0,
5254
"react-hooks/exhaustive-deps": 0,
53-
"prefer-arrow/prefer-arrow-functions": "error",
54-
"react/function-component-definition": ["error", {
55-
"named": "function-declaration",
56-
"unnamed": "arrow-function"
57-
}]
55+
"prefer-arrow/prefer-arrow-functions": "error"
56+
// "react/function-component-definition": ["error", {
57+
// "named": "function-declaration",
58+
// "unnamed": "arrow-function"
59+
// }]
5860
},
5961
"settings": {
6062
"import/parsers": {

front/src/App.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
import React from 'react';
2-
import logo from './logo.svg';
3-
import './App.css';
1+
// import React from 'react';
2+
// import logo from './logo.svg';
3+
// import './App.css';
44

55
const App = () => {
66
return (
7-
<div className='App'>
8-
<header className='App-header'>
9-
<img src={logo} className='App-logo' alt='logo' />
10-
<p>
11-
Edit <code>src/App.tsx</code> and save to reload.
12-
</p>
13-
<a className='App-link' href='https://reactjs.org' target='_blank' rel='noopener noreferrer'>
14-
Learn React
15-
</a>
16-
</header>
7+
<div>
8+
<span>test</span>
179
</div>
1810
);
1911
};

front/src/test.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
const myTest = () => {
2-
return 'test';
2+
return (
3+
<div>
4+
<span>test</span>
5+
</div>
6+
);
37
};
48

5-
myTest();
9+
export default myTest();

0 commit comments

Comments
 (0)