@upnread/post-renderer
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

logo

@upnread/post-renderer

You can use this library in any of your React projects.

Upnread is a CMS that help companies and users to build custom blogs! You can install @upnread/post-renderer library to render your amazing posts that you have created on your account.

NPM JavaScript Style Guide

Note

Before installing this library make sure that you have created an account in Upnread

Install

npm install --save @upnread/post-renderer

Read our documentation!

Enter to our documentation, we have a list of end points you can use to get your posts and build your custom blog.


Params

Param required value
post yes You need to the send post.body prop
primary_color No You can send post.blog.primary_color prop or just send any primary color HEX code

You can request your post by id or by slug

Example of usage

import React from 'react'
import PostRenderer, { getPost } from '@upnread/post-renderer'

async function fetchSinglePost() {
  const response = await getPost({
    slug: 'Your post slug',
    token: 'Your secret token'
  })

  return response
}

const App = () => {
  const [post, setPost] = React.useState({
    body: '',
    blog: { primary_color: '' }
  })

  React.useEffect(() => {
    async function fetchPost() {
      const { data } = await fetchSinglePost()
      setPost(data)
    }

    fetchPost()
  }, [])

  return (
    <PostRenderer primaryColor={post.blog.primary_color} post={post.body} />
  )
}

export default App

Visit our web site

https://upnread.com

Readme

Keywords

none

Package Sidebar

Install

npm i @upnread/post-renderer

Weekly Downloads

1

Version

1.0.8

License

MIT

Unpacked Size

116 kB

Total Files

15

Last publish

Collaborators

  • ricardomalagon