Giter VIP home page Giter VIP logo

Comments (6)

wwayne avatar wwayne commented on May 19, 2024

@EragonJ Good point, thanks.
I don't know if registering a custom event is the best way but it sounds good to me, let me try on it when I have time and welcome PR and advice.

from react-tooltip.

EragonJ avatar EragonJ commented on May 19, 2024

I added this for my personal use : EragonJ@599145b

If you are fine with this implementation for better idea, I am willing to help.

from react-tooltip.

EragonJ avatar EragonJ commented on May 19, 2024

The main problem is that it's hard to manipulate ReactTooltip from outside of the world (Or is it possible to expose any method for outer use ?)

Some idea from the document : https://facebook.github.io/react/tips/communicate-between-components.html

For communication between two components that don't have a parent-child relationship, you can set up your own global event system. Subscribe to events in componentDidMount(), unsubscribe in componentWillUnmount(), and call setState() when you receive an event. Flux pattern is one of the possible ways to arrange this.

from react-tooltip.

EragonJ avatar EragonJ commented on May 19, 2024

or, we can add one extra property for ReactTooltip to let users to decide whether they want to register this global event or not ?

from react-tooltip.

wwayne avatar wwayne commented on May 19, 2024

@EragonJ really appreciate for your enlightenment
now users can use ReactTooltip.hide() or ReactTooltip.rebuild() to dispatch global event

import ReactTooltip from 'react-tooltip'

class MyComponent extends React.Component {

onClick() {
  // will dispatch a global event, do unbind then bind 
  ReactTooltip.rebuild()
}

render() {
  <div>
   <a onClick={::this.onClick}>rebuild</a>
   <ReactTooltip />
  </div>

}

}

from react-tooltip.

EragonJ avatar EragonJ commented on May 19, 2024

@wwayne +++ !! Glad to see this patch :P

from react-tooltip.

Related Issues (20)

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.