1.0.3 • Published 3 years ago

react-hackclub-webring v1.0.3

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

react-hackclub-webring

react library for https://github.com/hackclub/webring that supports SSR

NPM JavaScript Style Guide

Install

npm install --save react-hackclub-webring

Usage

The library allows you to manage fetching the data when convenient by using fetchWebringData(). example/ has an example of fetching it client-side; example-next/ has an example of fetching it when rendering on the server using NextJS's getServerSideProps.

Code Example

import React from 'react'

import { HackClubWebring, fetchWebringData } from 'react-hackclub-webring'
import 'react-hackclub-webring/dist/index.css' // be sure to import the styles

const Example = () => {
  const [webringData, setWebringData] = useState(null)

  useEffect(() => {
    ;(async () => {
      //
      setWebringData(await fetchWebringData())
    })()
  }, [])

  return <HackClubWebring webringData={webringData} domainName='example.com' />
}

Props

PropDescriptionDefault ValueRequiredNotes
webringDatadata from the fetchWebringData() functionnoneYesAllows your app to manage fetching when convenient (for SSR and stuff)
domainNamethe domain name of your website as on the webring's home pagenoneYesFor those of us with multiple domains for our websites, it allows the webring to work correctly. Also because when SSR with NextJS, I don't think window.location.hostname is available

License

MIT © SConaway

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago