Skip to content

Instantly share code, notes, and snippets.

@luillyfe
Last active November 3, 2018 20:21
Show Gist options
  • Save luillyfe/8f7213d2f90702a014649db040132ec5 to your computer and use it in GitHub Desktop.
Save luillyfe/8f7213d2f90702a014649db040132ec5 to your computer and use it in GitHub Desktop.
class App extends Component {
...
componentDidMount() {
let { options } = this.state.options;
options = options.map(o => {
});
fetch("https://jsonplaceholder.typicode.com/options")
.then(options => JSON.parse(response))
.then(options => (
this.setState({
options
});
));
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment