React Codes
React Codes
npm i react-router-dom
fetch('https://fakestoreapi.com/products')
.then(res=>res.json())
.then(json=>console.log(json))
npm i axios
axios('https://fakestoreapi.com/products')
.then(result=>console.log(result))
console.log(data)
getData()
useEffect, useState
products - принести
setProducts = получить
console.log(products)
useEffect(() => {
setProducts(data)
getData()
}, [])
console.log(products)
return (
<div className='cards'>
products.map((el, idx)=>(
</div>
mixin
// .header__wrapper {
// display: flex;
// padding: 25px;
// align-items: center;
// }
// .header__link {
// font-weight: 400;
// font-size: 14px;
// line-height: 150%;
// align-items: center;
// color: #343030;
// margin-left: 48px;
// padding: 38px 0;
// }
// .header__search input {
// text-align: center;
// height: 48px;
// width: 295px;
// margin-left: 111px;
// }
// .header__search input::placeholder {
// font-family: 'Merriweather';
// font-style: normal;
// font-weight: 400;
// font-size: 14px;
// line-height: 150%;
// display: flex;
// align-items: center;
// color: #9F9F9F;
// }
// .header__search input:focus {
// outline: none;
// }
// .header__btn {
// height: 48px;
// background: #403432;
// border-radius: 0px;
// width: 122px;
// font-family: 'Merriweather';
// font-style: normal;
// font-weight: 700;
// font-size: 14px;
// line-height: 150%;
// color: #FFFFFF;
// }
// .header__btn:hover {
// background-color: #776763;
// border: none;
// }