react-cms-api

1.0.2 • Public • Published

react-cms-api

The package makes the connection between the frontend and casino-cms via API and renders the correct component based on the content type.

NPM JavaScript Style Guide

Install

npm install --save react-cms-api

Usage

import React, { Component } from 'react'
import { BrowserRouter, Route, Switch } from 'react-router-dom'
import CmsApi from 'cms-api'

const Page = () => (
  <h1>Page</h1>
)

const Page404 = () => (
  <h1>Page 404</h1>
)

const cmsApiConfig = {
  page: Page,
  page404: Page404,
  apiUrl: 'http://example.test/api',
  pageTypes: [
    'blogPage'
  ]
}

class Example extends Component {
  render () {
    return (
      <BrowserRouter>
        <Switch>
          <Route path="/" render={props => <CmsApi config={cmsApiConfig} {...props} />} />
        </Switch>
      </BrowserRouter>
    )
  }
}

export default Example

License

MIT © arpadsimon

Readme

Keywords

none

Package Sidebar

Install

npm i react-cms-api

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

16.4 kB

Total Files

6

Last publish

Collaborators

  • arpadsimon