Skip to content
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

How to use with ReactJS ? #269

Open
sovanjana opened this issue May 26, 2018 · 3 comments
Open

How to use with ReactJS ? #269

sovanjana opened this issue May 26, 2018 · 3 comments

Comments

@sovanjana
Copy link

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

@vincolus
Copy link

vincolus commented Jun 13, 2018

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.

@Pushplaybang
Copy link

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

@wl05
Copy link

wl05 commented Mar 28, 2020

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()
        });
    }, [])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants