Browse Source

add suffix / to example url (#1861)

was inconsistent across examples
main
Sai Ram Kunala 5 years ago
committed by GitHub
parent
commit
348a5b2888
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      content/docs/hooks-faq.md

4
content/docs/hooks-faq.md

@ -589,7 +589,7 @@ function ProductPage({ productId }) {
const [product, setProduct] = useState(null);
async function fetchProduct() {
const response = await fetch('http://myapi/product' + productId); // Uses productId prop
const response = await fetch('http://myapi/product/' + productId); // Uses productId prop
const json = await response.json();
setProduct(json);
}
@ -610,7 +610,7 @@ function ProductPage({ productId }) {
useEffect(() => {
// By moving this function inside the effect, we can clearly see the values it uses.
async function fetchProduct() {
const response = await fetch('http://myapi/product' + productId);
const response = await fetch('http://myapi/product/' + productId);
const json = await response.json();
setProduct(json);
}

Loading…
Cancel
Save