回答編集履歴
1
適切な変数名に変更
answer
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
}
|
9
9
|
}
|
10
10
|
|
11
|
-
const style = Object.entries(this.state.style).map(
|
11
|
+
const style = Object.entries(this.state.style).map(prop => `${prop[0]}: ${prop[1]}`).join(';');
|
12
12
|
const styledDiv = `<div style="${style}"></div>`
|
13
13
|
|
14
14
|
console.log(styledDiv); // > <div style="color: #000;size: 1rem"></div>
|