在使用 PlacesAutocomplete 制作的自定义小部件上更新值时,调查字段会被清除

Survey fields get cleared when updating value on a custom widget made with PlacesAutocomplete

我正在使用 SurveyJS 在 React/Redux 中快速构建调查表。

我使用 React 组件为 Google Maps Places Autocomplete 实现了一个自定义小部件。我的问题是,一旦出现建议并且字段状态发生变化,所有其他调查字段的内容都会被清除。有什么办法可以预防吗?

Here's what I did to integrate React Places Autocomplete 作为自定义小部件进入调查。

只要您 select 调用地址字段 onChange,组件就会丢失其他字段的状态。

"setState() will always lead to a re-render unless shouldComponentUpdate() returns false. If mutable objects are being used and conditional rendering logic cannot be implemented in shouldComponentUpdate(), calling setState() only when the new state differs from the previous state will avoid unnecessary re-renders." 来自 reactjs.org