createThreadSafeStore(reducer, preloadedState, enhancer)
Creates a Redux store that is may be accessed from any thread.
This is the recommended way to create a store.
There is some performance overhead in using createThreadSafeStore()
due to
synchronization, however it is small and mostly likely not impact UI.
Some quick benchmarks on an Android app have shown that:
- calling
getState
was always < 1ms with or without synchronization dispatch
calls to 1-3ms longer with synchronization- During a cold launch of app differences were more dramatic. Some calls to
dispatch
took +100ms more than an store that was not synchronized.
see createStore()
for usage.