JS Data
Data is the driving force behind your app. Integrate your custom JavaScript code with the web services in your app using these functions.
Get Recordsβ
Argumentsβ
Name
Type
Required
Default
Exampleβ
// Example with React
import React from 'react'
import { getRecords } from '@myjsblock/sdk'
interface Product {
name: string
price: number
image: string
description: string
}
export default function RelatedProducts(): JSX.Element {
const [relatedProducts, setRelatedProducts] = React.useState<Product[]>([]);
React.useEffect(() => {
getRecords<Product[]>().then(products => {
setRelatedProducts(products);
});
},[]);
return (
<ul>
{
relatedProducts.map((product) => (
<li>{product.name}</li>
));
}
</ul>
);
}Errorsβ
Error Code
Description
Get Current Recordβ
Exampleβ
Errorsβ
Error Code
Description
Last updated
Was this helpful?
