我们是大型 Angular 应用程序模块的开发人员。模块彼此独立,由不同的团队开发。我们想在我们的模块中使用 ngrx 存储。
另一个模块已经有一个 ngrx 存储。如果我尝试以通常的方式将商店添加到我们的 module.ts 中:
@NgModule({
imports: [
...
StoreModule.provideStore( ... )
],
...
Run Code Online (Sandbox Code Playgroud)
它打破了整个应用程序。有没有办法为我们的模块提供一个单独的存储?
(应用程序使用 ngrx2)
我使用react-leaflet在地图上可视化很长的路径.用户可以从列表中进行选择,我希望所选路径具有不同的颜色.更改状态和再次渲染太慢,我正在寻找更快的解决方案.
Leaflet路径元素有setStyle()方法,所以我的第一个想法是使用它而不是再次渲染.但是如何参考传单层?
class MyPathComponent extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
if (nextProps.selected){
this.setState({selected: true});
LEAFLET_POLYLINE.setStyle({
color: 'red'
});
}
return false;
}
render() {
return(
<Polyline polylines={this.props.path} />
);
}
}
Run Code Online (Sandbox Code Playgroud)
那么我应该在这段代码中编写什么而不是LEAFLET_POLYLINE?