@rcp/util.createmount
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@rcp/util.createmount

NPM version NPM Downloads

The utility for creating mountable view

Installation

npm install @rcp/util.createmount
# or use yarn
yarn add @rcp/util.createmount

Usage

import createMount from '@rcp/util.createmount'
const center = createMount({
  // default's opts in `open` function
})

// The `element` would be mounted on `mountNode`
// and `attributes` is the container node's attributes
center.open({
  element: <div>hahahaha</div>,
  attributes: {
    id: 'container',
    className: 'i-container'
    style: {
      position: 'absolute'
    }
  },
  mountNode: document.body
})

API

createMountCenter

Parameters

  • opts IMountOptions<P>
    • opts.mountNode Node mountNode fallback in open function (optional, default document.body)
    • opts.attributes any? attributes fallback in open function
    • opts.element ReactElement<P>? element fallback in open function

Returns IMountCenter

Related

Authors

This library is written and maintained by imcuttle, mailto:moyuyc95@gmail.com.

License

MIT

Package Sidebar

Install

npm i @rcp/util.createmount

Weekly Downloads

29

Version

2.0.0

License

MIT

Unpacked Size

15.6 kB

Total Files

11

Last publish

Collaborators

  • moyuyc