简体   繁体   中英

Zurb Foundation 6 refresh after React re-render

I'd like to use "orbit" plugin from Zurb Foundation Framework to display carousel. I use React to component render. First time all works because I call to jQuery(document).foundation();

But when react component is re-render (for example when I add new image) then Orbit isn't display. Call to jQuery(document).foundation(); throw error that I use function on element where foundation already exists.

In Zurb 6 also doesn't exists option .foundation('reflow') or .foundation('refresh')

Any hints how I can solve this problem?

You have to use Foundation.reInit function to reload foundation for a particular component.

In this case, you have to add

Foundation.reInit('orbit');

I thought the better place to add it is in componentDidUpdate method of your React.Component class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM