質問編集履歴
4
編集
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,43 +1,38 @@
|
|
1
1
|
```react
|
2
|
-
// App.js
|
3
|
-
|
4
|
-
// ComponentもReactと一緒にインポートする → OK
|
5
|
-
import React
|
2
|
+
import React from 'react';
|
6
3
|
import logo from './logo.svg';
|
7
4
|
import './App.css';
|
5
|
+
import Title from './components/Title';
|
8
6
|
|
9
|
-
import Title from './components/Title/Title';
|
10
|
-
|
11
|
-
//class componentの宣言 → OK
|
12
7
|
class App extends Component {
|
13
8
|
|
9
|
+
//Event handlerやstateを定義する場所 → OK
|
10
|
+
onClickHandler = () => {
|
11
|
+
let title = document.getElementById('versionCounter');
|
12
|
+
let upgradeButton = document.getElementById('upgradeButton');
|
13
|
+
upgradeButton.style.display = "none";
|
14
|
+
}
|
14
15
|
|
15
|
-
|
16
|
+
//render()メソッド → OK
|
16
|
-
|
17
|
+
render() {
|
17
|
-
let title = document.getElementById('versionCounter');
|
18
|
-
let upgradeButton = document.getElementById('upgradeButton');
|
19
|
-
upgradeButton.style.display = "none";
|
20
|
-
}
|
21
18
|
|
22
|
-
//render()メソッド → OK
|
23
|
-
render() {
|
24
|
-
|
25
|
-
|
19
|
+
//return → OK
|
26
|
-
|
20
|
+
return (
|
27
|
-
|
21
|
+
<div className="App">
|
28
|
-
|
22
|
+
<header className="App-header">
|
29
|
-
|
23
|
+
<Title
|
30
|
-
|
24
|
+
title="Hello World 3.0"
|
31
|
-
|
25
|
+
titleStyle={{color: 'orange'}}
|
32
|
-
|
26
|
+
onClick={this.onClickHandler}
|
33
|
-
|
27
|
+
>
|
34
|
-
|
28
|
+
Hello World <span id="versionCounter" style={{borderBottom: '1px solid orange'}}>3.0</span>
|
35
|
-
|
29
|
+
</Title>
|
36
|
-
|
30
|
+
</header>
|
37
|
-
|
31
|
+
</div>
|
38
|
-
|
32
|
+
);
|
39
|
-
}
|
40
33
|
}
|
34
|
+
}
|
35
|
+
export default App;
|
41
36
|
```
|
42
37
|
|
43
38
|
上記のコードをtypescriptに直したいのですがどこを直したらいいのでしょうか?
|
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -44,4 +44,5 @@
|
|
44
44
|
|
45
45
|
./src/index.tsx
|
46
46
|
Attempted import error: './App' does not contain a default export (imported as 'App').
|
47
|
+
Cannot find name 'Component'. TS2304
|
47
48
|
というエラーが出ています
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,7 +16,6 @@
|
|
16
16
|
onClickHandler = () => {
|
17
17
|
let title = document.getElementById('versionCounter');
|
18
18
|
let upgradeButton = document.getElementById('upgradeButton');
|
19
|
-
title.textContent = "4.0";
|
20
19
|
upgradeButton.style.display = "none";
|
21
20
|
}
|
22
21
|
|
@@ -27,7 +26,6 @@
|
|
27
26
|
return (
|
28
27
|
<div className="App">
|
29
28
|
<header className="App-header">
|
30
|
-
<img src={logo} className="App-logo" alt="logo" />
|
31
29
|
<Title
|
32
30
|
title="Hello World 3.0"
|
33
31
|
titleStyle={{color: 'orange'}}
|
@@ -36,9 +34,6 @@
|
|
36
34
|
Hello World <span id="versionCounter" style={{borderBottom: '1px solid orange'}}>3.0</span>
|
37
35
|
</Title>
|
38
36
|
</header>
|
39
|
-
<p className="App-intro">
|
40
|
-
To get started, edit <code>src/App.js</code> and save to reload.
|
41
|
-
</p>
|
42
37
|
</div>
|
43
38
|
);
|
44
39
|
}
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -45,4 +45,8 @@
|
|
45
45
|
}
|
46
46
|
```
|
47
47
|
|
48
|
-
上記のコードをtypescriptに直したいのですがどこを直したらいいのでしょうか?
|
48
|
+
上記のコードをtypescriptに直したいのですがどこを直したらいいのでしょうか?
|
49
|
+
|
50
|
+
./src/index.tsx
|
51
|
+
Attempted import error: './App' does not contain a default export (imported as 'App').
|
52
|
+
というエラーが出ています
|