0.3.5 • Published 4 years ago

react-capture v0.3.5

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

react-capture

Capture React component and download as PNG file using html2canvas.

react-capture

Install

yarn add react-capture

Use

import { useCapture } from 'react-capture'

export const Component = () => {
  const { snap } = useCapture()
  const element = useRef(null)

  const onClick = useCallback(() => {
    snap(element, { file: 'download.png' })
  }, [snap, element])

  return (
    <Wrapper>
      <ComponentWrapper ref={element}>
        <Component />
      </ComponentWrapper>

      <Button onClick={onClick} value="Download" />
    </Wrapper>
  )
}
0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.1.0

4 years ago