D
D
danikkk2016-01-19 12:37:45
JavaScript
danikkk, 2016-01-19 12:37:45

How to organize a large single page application?

I need to write a client for a call center, an application with a lot of widgets, tables, and so on. I want to use react, redux, webpack for it. But I do not know how to organize modularity and dynamic loading of modules. I was thinking about making a common layout and loading various widgets and so on through the iframe, which are separate redux applications, and using localstorage to synchronize the state, maybe this can be done differently?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
norlin, 2016-01-19
@danikkk

iframes are definitely a bad option - most likely you will get a lot of unexpected problems + technologically this is an obvious crutch.
Ajax has long been easy to use in any browser: load the necessary modules, paste them in the right places. Modularity within code is provided by CommonJS (requirejs) modules.

R
Roman_Kh, 2016-01-19
@Roman_Kh

There are several options for dynamically loading modules.
For example, you can place each component in a separate file, but at the end, instead of exports, insert the component into the browser's global scope.

var SomeComp = React.createClass({
   ...
})

window.SomeComp = SomeComp

And then in another file, you can easily refer to this component:
...
  render(){
      ...
     <SomeComp ... />
     ...
  }

True, with this approach, you will have to manually implement dynamic loading of scripts. However, it is not very difficult, and there are ready-made solutions.
But it's best to use webpack loaders . Moreover, they are just created for your task.

A
Andrew Lewman, 2016-01-20
@ImLoaD

Why don't you use Angular?

A
Andrew, 2016-01-28
@iCoderXXI

Pay attention to Ember.JS, the entry threshold is high, but it's worth it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question