0.2.6 • Published 4 years ago

use-contao v0.2.6

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

use-contao

This package provide hooks to use Contao data in React.

Requirements

A valid contao installation with the Contao Content API extension installed. The project is fully written in Typescript.

Usage

To fetch a single page, use:

const contao = useContao({server: {host: "https://www.goodwillrun.de"}, page: "/contao/page/slug/1"});
console.log(contao.pages.filter(p => p.url === "/contao/page/slug/1"));

To fetch more than one pages, use:

const contao = useContao({server: {host: "https://www.goodwillrun.de"}, pages: ["/contao/page/slug/1", "/contao/page/slug/2"]});
console.log(contao.pages);

To fetch the whole sitemap, use:

const contao = useContao({server: {host: "https://www.goodwillrun.de"}, sitemap: true});
console.log(contao.sitemap);

You can specify the language as set in Contao, too:

const contao = useContao({server: {host: "https://www.goodwillrun.de", lang: "en"}, sitemap: true});
console.log(contao.sitemap);
0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago