contentflare-react

1.0.15 • Public • Published

contentflare-react

React client for Content Flare - contentflare.io

Installation

npm i contenflare-react

Implementation

import React, { useState } from 'react'
import { Helmet } from 'react-helmet'
import { Page, Config } from 'contentflare-react'

Config.init({
    organization: 'ORGANIZATION_SLUG',
    publicKey:    'PUBLIC_API_KEY',
    error404:     'ROUTE_404_PAGE_IN_CONTENTFLARE',
})

const App = () => {
    const [title,       setTitle]       = useState('')
    const [description, setDescription] = useState('')

    return (
        <>
            <Helmet>
                <title>{title}</title>
                <meta name="description" content={description} />
            </Helmet>
            <Page
                pathname="/about-us"
                onChange={(error, { title, description, properties}) => {
                    if (!error) {
                        setTitle(title)
                        setDescription(description)
                    }
                }}
            />
        </>
    )
}

export default App

Readme

Keywords

none

Package Sidebar

Install

npm i contentflare-react

Weekly Downloads

21

Version

1.0.15

License

ISC

Unpacked Size

190 kB

Total Files

6

Last publish

Collaborators

  • content-flare