rhw

react-hackclub-webring

react library for https://github.com/hackclub/webring

Showing:

Popularity

Downloads/wk

0

GitHub Stars

10

Maintenance

Last Commit

1mo ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.7KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

Yes?

Categories

Readme

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100