-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demo usage is confusing / not explained #27
Comments
Hi! Thanks for your feedback! I agree the documentation requires some love and improvement. For a detailed explanation, I advise you to check this issue: #13. |
Well it is even more confusing after reading (the beginning of) issue #13. The reference As I understand it it needs to be defined in another DOM node which has edit : well turned out that export default class MyComponent extends PureComponent
{
constructor(props)
{
super(props);
this.handleClick = this.handleClick.bind(this);
this.reactHint = React.createRef();
}
handleClick()
{
this.tooltip.toggleHint();
}
render()
{
const ReactHint = ReactHintFactory(React);
return (<React.Fragment>
<ReactHint
attribute="data-toggle"
autoPosition
events
delay={100}
ref={(ref) => { this.tooltip = ref; }}
onRenderContent={(target, content) => (
<React.Fragment>
<p>Hello W0rld</p>
{target.someData}
</React.Fragment>)}
/>
<div data-toggle onClick={this.handleClick}>Hover me to toggle React Hint</div>
<button onClick={this.handleClick}>Click me to toggle React Hint</button>
</React.Fragment>);
}
} |
ReactHint is not your regular wrapping tooltip component library, this is the main point of confusion, e.g. this is incorrect: <ReactHint>
<div>Content of the toolttip</div>
</ReactHint> @monkeydri
Actually, <button data-rh="a tooltip">Click me</button>
<button data-rh="a tooltip">Click me</button>
...
// This will wrap the text of all tooltips into `<b /> tag`.
// In this example `content` === "a tooltip"
onRenderContent{(target, content) => <b>{content}</b>} As for your example: render() {
const ReactHint = ReactHintFactory(React); Performance-wise you shouldn't place a factory inside of the |
Thanks for your answer, I understand now why the doc stated that For the |
The working demo looks promising, but I gave up almost instantly trying to implement this library for the following reasons:
autoPosition events delay={100}
from first to second (and get rid of first)? I'm sure there's a reason that's clear to the architect, but it's not intuitive or explained.this.instance
? There is no such property given in the componentThe text was updated successfully, but these errors were encountered: