Nativescript: Errors with Redux and Angular2, not a single example on the entire web :(

Created on 21 Oct 2016  路  4Comments  路  Source: NativeScript/NativeScript

so for 2 days been trying to get Redux working with NativeScript and angular 2 and no luck... all works fine in browser but not in NativeScript... and can't find a single example on the entire web for anyone using redux with NS... :/

this is the error

JS:     at /data/data/org.nativescript.groceries/files/app/Lib.js:23:62
JS:     at NgModuleInjector.Object.defineProperty.get (AppModule.ngfactory.js:210:61)
JS:     at NgModuleInjector.AppModuleInjector.getInternal (AppModule.ngfactory.js:284:48)
JS:     at NgModuleInjector.get (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:7135:31)
JS:     at ElementInjector.get (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:9208:52)
JS:     at ReflectiveInjector_._getByKeyDefault (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:3297:28)
JS:     at ReflectiveInjector_._getByKey (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:3263:29)
JS:     at ReflectiveInjector_.get (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:3072:25)
JS:     at DebugAppView._View_LoginComponent_Host0.createInternal (LoginComponent_Host.ngfactory.js:16:189)
JS:     at DebugAppView.AppView.create (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:9323:25)
JS: Error: Uncaught (in promise): Error: Error in ./LoginComponent class LoginComponent_Host - inline template:0:0 caused by: thunkMiddleware is not defined

not very informative I know.
I would thing NativeScript guys would have a single example with redux but no such luck.

The only thing I can get working is just a redux store with a single reducer.
but as soon as I try to combineReducers or add middleware, it all explodes...

no idea why

all vanilla redux stuff:

    const middlewareEnhancer = applyMiddleware(<any>thunkMiddleware);
    const enhancers = compose(middlewareEnhancer);
    const createStoreWithEnhancers = enhancers(createStore);
    const reduxAppStore = createStoreWithEnhancers(reducerList);
    return reduxAppStore;

I welcome any help but at this point, without any stack trace info I can work with, I feel it's a lost cause...

regards

Sean

question

Most helpful comment

Hey Sean you can check this video - https://www.youtube.com/watch?v=jH5I8ZPzXWE

and a sample app that uses NativeScript and Redux - https://github.com/vakrilov/ngrx-devtools-nativescript

All 4 comments

Hey Sean you can check this video - https://www.youtube.com/watch?v=jH5I8ZPzXWE

and a sample app that uses NativeScript and Redux - https://github.com/vakrilov/ngrx-devtools-nativescript

thanks for the info... but he is using ngrx and not redux :(
not the same.
I see you closed the issue but it is clearly not resolved.
I would like to see nativescript guys implement a simple Redux with combined reducers and thunk, I am not asking for too much?

please re-open the issue

regards

Sean

Hey @born2net
The example is indeed using ngrx. Which is implementation of the Redux pattern, but does not depend on the Redux library.

Sorry for the misunderstanding - I will reopen your other issue - let's continue the discussion there.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NickIliev picture NickIliev  路  3Comments

NordlingDev picture NordlingDev  路  3Comments

Pourya8366 picture Pourya8366  路  3Comments

rogangriffin picture rogangriffin  路  3Comments

OscarLopezArnaiz picture OscarLopezArnaiz  路  3Comments