Search code examples
javascriptrequirelodashrefluxjs

How can I access lodash in the javascript console when using reflux


I am working on an app which uses the Reflux framework around React. When we want to use an external library in a file we require with:

import _ from 'lodash';

Then we can use the _. to access all the lodash methods. I would like to also like to be able to access _. in the javascript console when developing. Is there a way to require lodash so that it is available there?


Solution

  • You can mount it in componentDidMount() in some component. like:

    componentDidMount() {
      window._ = _;
    }