0
class App extends Component {
constructor(props){
super(props);
}
render() {
const {socialJSX} = this.props.items?this.props.items.map((item)=> {
return <a className={"icon32-"+item.Title} href={item.Link.Url} target="_blank" title={item.Description} />
}):"";
debugger
return (
<div id="socialWrapper">
<div id="socialWrap">
{socialJSX}
</div>
</div>
);
}
componentWillMount() {
fetch(`http://remoteurl`, {
method: 'GET',
headers: {
'Accept': 'application/json;',
'Content-Type': 'application/json'
}}).then((response) => {
return response.json();
})
.then((response) => {
$.each(response.value,(index, value)=>{
if(value){
this.props.appState.addItem({
Title:value.Title,
Active:value.Active,
Description:value.Description,
Link:{Address:value.Link.Url, Description:value.Link.Description}
});
}
});
})=
}
}
export default observer(App);
하는 index.js : 여기
코드입니다 .. 내가 브라우저에서 HTML 출력하지만, 빈 페이지를 볼 것으로 예상 jsx 요소를 만드는 데 반복const appState = new AppState();
ReactDOM.render(
<App appState={appState} />,
document.getElementById('root')
);
AppState 서비스 .js
import { extendObservable, computed } from 'mobx';
class AppState {
constructor() {
extendObservable(this, {
items: []
});
}
addItem(item) {
debugger
this.items.push(item)
}
}
export default AppState
항목에로드 된 콘텐츠 데이터를 확인했습니다. 여기에 무슨 문제가 있습니까?