@wbsuite/react-hooks v1.0.29
Installing wbsuite react hooks library
- Install dependency in your proyect by running
npm i @wbsuite/react-hooks
How to use
- Set up wbsuite by running the
useWBSuite
hook with the api key you were given.
function App() {
useWBSuite({ apiKey: '<your-api-key>' });
return <></>
}
- You're ready to start using the hooks you need. This library version contains:
- useStores -- lists available stores for your team
- useProducts -- lists products available for your team
- useCategories -- lists categories available for your team
- useRenting -- renting utils
- useDocuments -- document / images utils
- useContact -- create leads for your campaigns, use this for contacts or whatever you need.
useCategories
This hook is used to list, get or create categories. In order to use it consider:
const { list: listCategories } = useCategories();
useEffect(() => {
listCategories().then(categoryList => {
// Do what you need with the categoryList
});
}, []);
useProducts
This hook is used to list, get or create products. In order to use it consider:
const { list: listProducts } = useProducts();
useEffect(() => {
/** filters needs to be an object with any valid property of the product schema.
* for example to get the products from a category you need to pass in an object like:
* { categories: <categoryId>[] }
*
* { categories: ['some-category-id', 'other-category-id'] }
*
* The categoryId can be retrieved from the useCategories hook explained above.
**/
listProducts(filters ?? {}).then(filteredProductList => {
// Do what you need with the filteredProductList
});
}, []);
Permissions
Even if the hooks are available in the library the apiKey
limits the permissions you have
access to.
Which means, that you won't be able to use all of our features unless you were given access to.
If, you find yourself in need of using a non-accessible util, please reach out to the provider.
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago