Coder Social home page Coder Social logo

zjcomeon / create-portal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyy1115/create-portal

0.0 1.0 0.0 5 KB

一个封装好的react portal组件,你不需要在body下面写静态的HTML,使用create-portal可以自动生成DOM结构。

License: MIT License

JavaScript 100.00%

create-portal's Introduction

create-portal

一个封装好的react portal组件,你不需要在body下面写静态的HTML,使用create-portal可以自动生成DOM结构。

安装

npm i --save create-portal

用法

1、组件用法

<CreatePortal
  element={`a`} //String,默认为div
  id={`id`} //tring,可以不设置
  className={`classname`} //String,可以不设置
  style={{width: '100px'}} //Object,可以不设置
 >
    此处插入div或者react组件
</CreatePortal>

2、渲染结果

<body>
<div id="root"}>通常这是你的React根入口的元素</div>

<!--portal生成的DOM结构位于根元素之外-->
<a id="id" class="classname" style="width: 100px">
    此处插入div或者react组件
</div>
</body>

create-portal's People

Contributors

hyy1115 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.