Last active
April 21, 2018 05:31
-
-
Save oneybee/9d08eb77f63e0bc92e7cda459cd7b090 to your computer and use it in GitHub Desktop.
api setting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import PropTypes from 'prop-types'; | |
import Interactive from 'react-interactive'; | |
import { Link } from 'react-router-dom'; | |
import { Li } from '../styles/style'; | |
import s from '../styles/exampleTwoDeepComponent.style'; | |
class ExampleTwoDeepComponent extends Component { | |
constructor() { | |
super() | |
this.state = { | |
data: [], | |
} | |
} | |
componentDidMount() { | |
return fetch(' ') | |
//' '안에 API URL을 넣어줍니다. | |
.then((response) => response.json()) | |
.then((responseJson) => { | |
this.setState({ | |
data:responseJson | |
// 불러온 API data에서 어떤 정보를 찾을지 지정해줍니다. | |
}) | |
console.log(this.state.data) | |
}) | |
} | |
render() { | |
return ( | |
<div> | |
{ | |
this.state.data.map( (dynamicData,key)=> | |
<div key={key}> | |
{console.log('dynamicData', dynamicData)} | |
</div> | |
) | |
} | |
</div> | |
) | |
} | |
} | |
export default ExampleTwoDeepComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment