kunukn / react-slide-toggle

React component re-implementation for jQuery.slideToggle feature
MIT License
42 stars 7 forks source link

Window is undefined for server-side rendering and Collasible typo #1

Closed williamgrh closed 6 years ago

williamgrh commented 6 years ago

Hi, I love the simplicity of this component but ran into a minor issue trying to use it.

When using this component for a server-side rendered application, window is undefined. Adding a check to ensure that window is not defined allows this component to be imported properly by server-side rendered applications. As the client should be the only thing using this component this is not dangerous.

Also, there is a prop passed to the render function called setCollasibleElement. In the source code it is mapped to setCollapsibleElement, I assume this was a typo and have fixed it as well.

Please let me know if you would like me to create a branch and PR with these fixes. Thanks.

kunukn commented 6 years ago

Thanks.