Components
Content Provider

Content Provider <ContentProvider />

Content provider initializes a content and let's Contza know that all of the children Contza components belong to the content.

Props

slugDefines the slug of the content (for example 'index' or 'blog/blog-post-name')
localeDefines what locale should be used (note that this prop doesn't take an effect if the content has any initial content)
initialContentInitial content. This prop is really useful when dealing with different rendering strategies such as SSR.
childrenChildren component.

Examples

Here are few examples how to use Contza provider component.

Basic usage

import { ContentProvider } from "@contza/react";
 
const Page = () => {
  return (
    <ContentProvider slug="index">
      {/* Rest of the application */}
    </ContentProvider>
  );
};
 
export default Page;

Using with 'locale' prop

In this example we will use a finnish version of the content.

import { ContentProvider } from "@contza/react";
 
const Page = () => {
  return (
    <ContentProvider slug="index" locale="fi">
      {/* Rest of the application */}
    </ContentProvider>
  );
};
 
export default Page;