drop icon indicating copy to clipboard operation
drop copied to clipboard

NodeJS support

Open eliseumds opened this issue 9 years ago • 1 comments

It would be great if Drop.js could also render on the server with React.js. Currently it cannot even be imported because document wouldn't be defined. That would require the initial document uses to be wrapped by something like if (typeof window !== 'undefined') { ... }.

eliseumds avatar Sep 13 '16 18:09 eliseumds

Use the require function to import tether drop in the componentDidMount function.

componentDidMount() {
  const Drop = require('tether-drop');
  this.dropInstance = new Drop({
    target: document.querySelector('.drop-target'),
    content: 'Welcome to the future',
    classes: 'drop-theme-arrows',
    position: 'bottom left',
    openOn: 'click'
  });
}

emjaksa avatar Sep 22 '16 15:09 emjaksa