Skip to content

Instantly share code, notes, and snippets.

@Jiveloper

Jiveloper/ex.js Secret

Created November 12, 2022 10:54
Show Gist options
  • Save Jiveloper/a650bc2cbb9fd5efe3e35460900c1fd1 to your computer and use it in GitHub Desktop.
Save Jiveloper/a650bc2cbb9fd5efe3e35460900c1fd1 to your computer and use it in GitHub Desktop.
리액트
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