Skip to content

the flexible way to render React "root" element, the enhancement of ReactDom.render method.

Notifications You must be signed in to change notification settings

bowen31337/react-dom-super-render

Repository files navigation

react-dom-super-render

enhance ReactDom.render method

NPM JavaScript Style Guide

Install

npm install --save react-dom-super-render

Usage

index.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">

    <link rel="manifest" href="%PUBLIC_URL%/manifest.json">

    <title>react-dom-super-render</title>
  </head>

  <body>
    <noscript>
      You need to enable JavaScript to run this app.
    </noscript>
    <div id="root"></div>
  </body>
</html>

index.js

import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'

import ReactDomRender from 'react-dom-super-render'

//second argument is enum
//type secondArg = "before" | "after" | "append" | "prepend" | "replaceWith"; 
//default value "replaceWith"
const superRender = ReactDomRender(ReactDOM.render,'replaceWith')

superRender(<App />, root)

Demo Page rendered from the codes is https://bowen31337.github.io/react-dom-super-render/

License

MIT © https://github.com/bowen31337

About

the flexible way to render React "root" element, the enhancement of ReactDom.render method.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published