Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Conversation

yotamberk
Copy link
Member

This is important for rendering components to the element of the item for libraries like React.
When we want to mount a react component to the template, we have to have the item/group element itself so we can do something like ReactDOM.render(<your template>,element).

You can now use the timeline options templates with react components:

options = {
   template: function (item, element) {
        return ReactDOM.render(<b>{item.content}</b>, element);
   },
   groupTemplate: function (group, element) {
       return ReactDOM.render(<b>{group.content}</b>, element);
   }
}

Copy link
Member

@mojoaxel mojoaxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
I specially like the React integrating! Nice! ;-)

@mojoaxel mojoaxel merged commit 439aa79 into visjs:develop Oct 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants