Giter VIP home page Giter VIP logo

react-mirror's Introduction

react-mirror

react-mirror

Mirror any react component.

Given any wrapped react component, e.g. <Surface>component</Surface>, react-mirror allows you to mirror those components within any other component's render method, placing any number of <Mirror />.

react-mirror

-- Each mirror is a full clone of the DOM Node it reflects, being replaced by a new clone for each reported mutation. Therefore, don't use this method in order to get a performance boost. --

API

js-standard-style

Sample Usage

class Demo extends Component {

  componentDidMount () {
    this.refs.mirror.reflect(this.refs.surface)
  }

  render () {
  
    return (
      <div>
        <Surface ref="surface">
          <SomeOtherComponent />
        </Surface>
        <Mirror ref="mirror" />
      </div>
    )
  }
}

<Surface />

Surface will render any react component without being appended to the DOM tree.

PARAMS DEFAULT DESCRIPTION
initialMirror true Automatically creates a Mirror for this Surface.
equalityTest true Accepts any primitive value (taken as boolean) or a function to retrieve that value given previous and next props from the wrapped component as arguments.
This value represents the equality comparison of the given arguments. So, when NOT positive, it will update Surface's internal ReactElement with the next one.
* If you pretend to pass down updated props to the wrapped component you have to specify some other value than true here. Like false or any shallowEqual implementation out there.

<Mirror />

Mirror.reflect([object surface])

Changes the `Surface` being reflected by this mirror. Stops mirroring when no surface is specified (or `null`).

react-mirror's People

Contributors

theadd avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

snagi

react-mirror's Issues

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.