回答編集履歴
3
a
test
CHANGED
@@ -139,3 +139,99 @@
|
|
139
139
|
|
140
140
|
|
141
141
|
今回の質問はレイアウトの話だと思いますが、Reactに[atomic design](http://bradfrost.com/blog/post/atomic-web-design/)の考え方を取り入れて、atom, molecule, organism, page, template単位でコンポーネントを作って、今回みたいなことをやるというのも良いかと思います。
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
# 追記
|
148
|
+
|
149
|
+
パターンAの別バージョンも書いてみました。
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
```
|
154
|
+
|
155
|
+
const Header = () => {
|
156
|
+
|
157
|
+
return (
|
158
|
+
|
159
|
+
<nav>
|
160
|
+
|
161
|
+
<ul>
|
162
|
+
|
163
|
+
<li>1</li>
|
164
|
+
|
165
|
+
</ul>
|
166
|
+
|
167
|
+
</nav>
|
168
|
+
|
169
|
+
);
|
170
|
+
|
171
|
+
};
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
const Body1 = ({ content }) => {
|
176
|
+
|
177
|
+
return <div>{ content }</div>;
|
178
|
+
|
179
|
+
};
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
class LayoutA extends React.Component {
|
186
|
+
|
187
|
+
render() {
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
const {
|
192
|
+
|
193
|
+
Component,
|
194
|
+
|
195
|
+
...props
|
196
|
+
|
197
|
+
} = this.props.body;
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
return (
|
202
|
+
|
203
|
+
<div>
|
204
|
+
|
205
|
+
<Header />
|
206
|
+
|
207
|
+
<Component { ...props } />
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
);
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
class App extends React.Component {
|
220
|
+
|
221
|
+
render() {
|
222
|
+
|
223
|
+
return (
|
224
|
+
|
225
|
+
<div>
|
226
|
+
|
227
|
+
<LayoutA body={{ Component: Body1, content: 'Hello Body1' }} />
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
);
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
```
|
2
あ
test
CHANGED
@@ -138,4 +138,4 @@
|
|
138
138
|
|
139
139
|
|
140
140
|
|
141
|
-
今回の質問はレイアウトの話だと思いますが、Reactに[atomic design
|
141
|
+
今回の質問はレイアウトの話だと思いますが、Reactに[atomic design](http://bradfrost.com/blog/post/atomic-web-design/)の考え方を取り入れて、atom, molecule, organism, page, template単位でコンポーネントを作って、今回みたいなことをやるというのも良いかと思います。
|
1
http://bradfrost.com/blog/post/atomic-web-design/
test
CHANGED
@@ -135,3 +135,7 @@
|
|
135
135
|
|
136
136
|
|
137
137
|
```
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
今回の質問はレイアウトの話だと思いますが、Reactに[atomic design/](http://bradfrost.com/blog/post/atomic-web-design/)の考え方を取り入れて、atom, molecule, organism, page, template単位でコンポーネントを作って、今回みたいなことをやるというのも良いかと思います。
|