JSPM

pikaso-react-hook

2.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 318
  • Score
    100M100P100Q137482F
  • License MIT

Pikaso React Hook

Package Exports

  • pikaso-react-hook
  • pikaso-react-hook/esm/index.js
  • pikaso-react-hook/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pikaso-react-hook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pikaso-react-hook

React hook for Pikaso

Language Test, Build and Publish npm coverage

Install

NPM

npm install pikaso-react-hook --save

Yarn

yard add pikaso-react-hook

Getting Started

import React from 'react'
import usePikaso from 'pikaso-react-hook'

export function Component() {
  const [ref, editor] = usePikaso()
  
  const createCircle = () => {
    editor.shapes.circle.insert({
      x: 200,
      y: 200,
      radius: 50,
      fill: 'red'
    })
  }

  return (
    <>
      <div
        ref={ref}
        style={{
          background: '#ccc',
          width: '400px',
          height: '400px'
        }}
      />
      
      <button onClick={createCircle}>Create Circle</button>
    </>
  )
}

Demo

https://codesandbox.io/s/pikaso-react-hook-example-i0uwg

Documentation

https://github.com/pikasojs/pikaso