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

Problems getting started #21

Open
essekia opened this issue Feb 15, 2016 · 2 comments
Open

Problems getting started #21

essekia opened this issue Feb 15, 2016 · 2 comments

Comments

@essekia
Copy link

essekia commented Feb 15, 2016

Hi,

    var rewire = require('rewire-webpack');
    var testStore = rewire('stores/test-store');
    console.log("testStore: " +  !!testStore);

I have a feeling that I am missing something obvious, but shouldn't testStore return true? I get 'false'. And I cannot set or get anything as 'testStore' always seems to be undefined.

other info:

  1. no babel, no es6, just a simple test store (singleton).
  2. rewire is installed, and !!rewire.apply returns true. ( so I am guessing rewire is setup correctly.)
  3. using webpack.
  4. using "require" in place of rewire returns 'true'.
  5. I should also mention that I use AMD format for all my modules.
@essekia
Copy link
Author

essekia commented Feb 17, 2016

Never mind. As I suspected, it was something silly on my part.

@essekia
Copy link
Author

essekia commented Feb 17, 2016

Another query regarding matching view with the rewired store.

So here is my problem, I have a rewired 'flightStore' and a 'flightView' which has 'flightStore' as its dependency. How do I match the current rewired version of the flightStore in the flightView? Should I use rewire the view and use 'set' on it somehow to match the stores (or) the variables used in the view? Is there another simpler way to do this?

                var registeredCallback = flightStore.__get__("registeredCallback");

                registeredCallback({
                    actionType: 'choose-flight',
                    type: 'business-class'
                });

                ReactDOM.render(
                    React.createElement(flightView, {
                        className: parentID,
                        key: parentID
                    }),
                    document.getElementById(tempID)
                );

Thanks much!

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

1 participant