setState(prevItem => [...prevItems, ...newItems])const response = await fetch(url + query).then(data => data.json())
setData(v => [...v, response])Argument of type '(v: never[]) => any[]' is not assignable to parameter of type 'SetStateAction<never[]>'.
Type '(v: never[]) => any[]' is not assignable to type '(prevState: never[]) => never[]'.
Type 'any[]' is not assignable to type 'never[]'.
Type 'any' is not assignable to type 'never'. useEffect(() => {
getProducts(offset, LIMIT).then(products => setProducts(v => [...v, ...products]))
}, [offset]);[offset] в концу useEffect?const LIMIT = 10;
const getProducts = async (offset, limit) => { ... }
function App () {
const [offset, setOffset] = useState(0);
const [products, setProducts] = useState([])
useEffect(() => {
getProducts(offset, LIMIT).then(products => setProducts(v => [...v, ...products]))
}, [offset]);
return <RenderProducts onScroll={() => { // increment offset }} />
}v => [...v, ...products] зачем мы здесь делаем так, а не просто setProducts(pdoducts)?setProducts(v => [...v, ...products]?setProducts(pdoducts) и в useEffect был пустой массивuseEffect(() => {
getProducts(offset, LIMIT).then(products => setProducts(products))
}, []);setProductsнужно через колбек значение передавать?setProducts(v => [...v, ...products] root /home/apps/site/public//images/pic.jpg/home/apps/site/public/images?if ( $request_uri ~ "/index.html" ) {
rewrite ^(|/(.*))/index\.html$ /$2 permanent;
}(css| js | jpg), а тут немного иначе
аксес и эрор лог без ошибок