add suffix / to example url (#1861)

was inconsistent across examples
This commit is contained in:
Sai Ram Kunala
2020-03-09 15:27:31 +00:00
committed by GitHub
parent fb382ccb13
commit 348a5b2888

View File

@@ -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);
}