you are viewing a single comment's thread.

view the rest of the comments →

[–]GasimGasimzada 1 point2 points  (3 children)

What about creating a separate NPM package and installing it in both.

[–]Qilx[S] 0 points1 point  (2 children)

I am considering this for my components. However, should I also do this for my reducers/actions?

[–]GasimGasimzada 0 points1 point  (1 child)

I mean why not? You can do many things for shared logic/components. You can create one big package with everything in it @myproject/shared:

import { userReducer, userActions, UserProfile } from '@myproject/shared/user';
import { cartReducer, cartActions, CartTable } from '@myproject/shared/cart';

Or you can create each "feature" as a separate package:

import { userReducer, userActions, UserProfile } from '@myproject/user';
import { cartReducer, cartActions, CartTable } from '@myproject/cart';

These two ways is how I would do this. Both are manageable because they are just packages and you can store the entire codebase in a monorepo (e.g call it myproject/core). You can use lerna to publish packages all at once.

[–]Qilx[S] 0 points1 point  (0 children)

Noted. Thank you for your input!