jonathantneal / flexibility

A JavaScript polyfill for Flexbox

Home Page:https://jonathantneal.github.io/flexibility/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to use with reactjs

gmchaturvedi1 opened this issue · comments

can u please guide me how to use this with reacrtjs

Can you provide details on your build setup (e.g., webpack, SystemJS, Babel CLI, etc)?

I'm also looking for the 'right' way to do this.

I'm using Webpack with Babel and SCSS.

I tried importing the module, and calling walk as per #57 but was receiving an error about walk not being defined unless I called init beforehand.

Should init be called on each component, or shouldflexibility just be imported and init'ed on the root component?

flexibility.init was undefined for me because the js is minified when installing via npm but managed to get this working by doing the following...

Call the function on the root component:

componentDidMount() {
    flexibility(document.body).
}

If using react-router you'll need to call this function every time you change page:

update() {
    flexibility(document.body);
}

// somewhere in render function
<Router history={browserHistory} onUpdate={this.update}>