0.0.2 • Published 5 years ago

@hrdtbs/use-jquery v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

useJQuery

$ yarn add @hrdtbs/use-jquery jquery react @types/jquery @types/react
const App:React.FC = () => {
  const ref = useRef<HTMLDivElement>(null)
  
  useJQuery(ref, $ => {
    $.fadeOut(3000).fadeIn(3000)
  })

  const text = useJQuery(ref, $ => {
    return $.text()
  })
  
  useEffect(()=> {
    console.log(text)
  },[text])
  
  return (
    <div ref={ref}>Hello, jQuery</div>
  )
}