Skip to content

wangkaiwd/react-hooks-components

Repository files navigation

React practice

Usage

Install

npm install @sppk/antd

Use in your code:

import { Input } from '@sppk/antd'

const YourComponent = () => {
  const [value, setValue] = useState('')
  const onInputChange = (e) => {
    setValue(e.target.value)
  }
  return <Input value={value} placeholder={'Please input something..'} />
}

Motivation

Write some components to study usage of React Hooks.

Implement following components:

  • Input
  • AutoComplete
  • Menu
  • VirtualList

And implement following simple but useful custom hooks:

  • useUpdate
  • useUpdateEffect
  • useGetSet
  • useGetSetState
  • useRequest

Test Library:

  • jest
  • @testing-library/react
  • @testing-library/react-hooks

Build Library:

  • create-react-app: run project in local
  • rollup: generate bundle for production environment

Document:

Disclaimer

This project only for study purpose, don't use it in production environment!

All of my code learn from following projects source code and make some simplify:

I learn a lot of React ecosystem knowledge from this project and record my experiences in here.

If you are also studying React, hope this can help you ❤️.