asp.net MVC with redux #4482
-
Hi, This is not an issue with the library and more of a how to question but scouring the internet I'm struggling to find anything of use that can be adapted so figured asking here I may get a decent response from the authors / contributors / interested parties. I am working with an asp.net MVC application that was littered with variables all over various files and essentially being thrown into the global scope. I have experience of React with Redux so thought this would be a great opportunity to tidy up our application state and use a pattern that would give us some boundaries of operation. I've implemented the toolkit in typescript and willingly placed use of it all over the code base. I've configured webpack to provide one entry point per html file that is served (including partials) What I am finding is that the store is created multiple times which from the reading around seems quite logical. What I would like to do is somehow elevate the store to a single place that each javascript file can access so I only get one instance for the entire application. This may not be best practice but would serve as an improvement to be iterated on in the future. Currently it feels like the only solution is to move the store to the global scope and access it accordingly from there but before I do that I wanted to ask if there was a better way that this could be achieved. Apologies for asking an integration question on an issue log; hoping you may be able to offer some advice |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yeah, generally you either need to make sure that all of those separate entry points are somehow sharing and importing a single module file (like an |
Beta Was this translation helpful? Give feedback.
Yeah, generally you either need to make sure that all of those separate entry points are somehow sharing and importing a single module file (like an
app/store.ts
) once no matter how many of the entry points get loaded into the page, or do some work to create the store once and add it to the global scope if it doesn't exist yet.