Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 28069ca

Browse files
author
smishra38@sapient.com
committed
Changing the Data-retrieval technique to Fetch API
1 parent c9fbee2 commit 28069ca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/components/Quiz.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ class Quiz extends React.PureComponent{
3030
this.loadCommentsFromServer = this.loadCommentsFromServer.bind(this);
3131
}
3232
loadCommentsFromServer() {
33-
axios.get(this.props.url)
34-
.then(res => {
35-
this.setState({ data: res.data });
33+
fetch(this.props.url)
34+
.then(res => res.json())
35+
.then(data=>{
36+
this.setState({ data });
3637
})
3738
}
3839

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /