-
-
Save Jiveloper/a650bc2cbb9fd5efe3e35460900c1fd1 to your computer and use it in GitHub Desktop.
리액트
This file contains 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
const [products, setProducts] = React.useState([]); | |
React.useEffect(function () { | |
axios | |
.get( | |
'https://ccf0cead-6922-44ad-b7f7-8b997f9994c3.mock.pstmn.io/products' | |
) | |
.then(function (result) { | |
const products = result.data.products; | |
setProducts(products); | |
}) | |
.catch(function (error) { | |
console.error('에러 발생 : ', error); | |
}); | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment