slideout icon indicating copy to clipboard operation
slideout copied to clipboard

How to use with ReactJS ?

Open sovanjana opened this issue 6 years ago • 3 comments

This library is really great but surprisingly I have not found a single solution about how it works with react js. Need help.

sovanjana avatar May 26 '18 10:05 sovanjana

I found this thread on stackoverflow which had an answer: https://stackoverflow.com/questions/45216214/how-to-use-slideout-js-using-reactjs-and-webpack?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

This is what I did, but it did not work:

import Slideout from 'slideout';

  [...] 

this.slideout = new Slideout({
    'panel': document.getElementById('panel'),
    'menu': document.getElementById('menu'),
    'padding': 256,
    'tolerance': 70
});

The 'menu'-propery is null after (or more while) it is initialized.

vincolus avatar Jun 13 '18 18:06 vincolus

@vincelord - theres good documentation on integrating third party libs, Have a look at: https://reactjs.org/docs/integrating-with-other-libraries.html

Pushplaybang avatar Sep 03 '18 09:09 Pushplaybang

you can do this,it works with react hooks

useEffect(() => {
        const slideout = new Slideout({
            'panel': navRef.current,
            'menu': mainRef.current,
            'padding': 256,
            'tolerance': 70
        });
        // Toggle button
        searchRef.current.click(function () {
            slideout.toggle()
        });
    }, [])

wl05 avatar Mar 28 '20 08:03 wl05