1.0.0 • Published 3 years ago

ith-ui-react v1.0.0

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

ith-ui-react

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save ith-ui-react

Usage

This simple example shows the use of a lookup component, and a display component. You could, of course, write your own custom components to render the data that the API returns, but the library provides a couple of pre-built options (in this case, the <MemberCard /> component).

The <MemberLookup /> component renders a simple UI that includes a button that will query the In The House API on click with the user input. Passing a callback exposes the return value of the API to the parent component. You could write any function you like to handle the response, but this example shows a common pattern where the resultant MP is stored as local state and then passed off to another component.

import React from 'react'

import { MemberCard, MemberLookup, MemberResponse } from 'ith-ui-react'

const App = () => {
  const [member, setMember] = React.useState<MemberResponse | null>(null)

  return (
    <div>
      <MemberCard mp={member} />
      <MemberLookup callback={setMember} searchBy='name' />
    </div>
  )
}

License

MIT © stephenpalgeorge