I'm thinking about building a pretty complex chart component in React, and I want it to be resuable across many different project. Needless to say, a component like that has a multitude of states that needs to be managed somehow.
Redux seems like the perfect fit for this, but if I just wrap the top level container in a Provider with a custom store... wouldn't the component's internal redux store interfere with the global application state if the component is included in a larger React/Redux app?
import React, { Component } from 'react';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import internalReducer from './reducer';
export default class MyReduxComponent extends Component {
render() {
const store = createStore(internalReducer, this.props.initialState);
return <Provider store={store}>
<Chart />
</Provider>
}
}