给到组件的值,使用useState包裹,

const Toggle: React.FC<ToggleProps> = ({ onToggle }) => {
  const queryData = [{ path: 'DDUser_AccessAreas', query: '' }];
  return (
      <DataQuery queryData={queryData} isShowLoading={false}>
        {(data) => {return <></>;}
      </DataQuery>
  );
};
export default Toggle;

使用useState包裹,这样子,当Toggle重绘时,就不会因为参数变更导致可能的再次刷新DataQuery

const Toggle: React.FC<ToggleProps> = ({ onToggle }) => {
  const [queryData] = useState([{ path: 'DDUser_AccessAreas', query: '' }]);
  return (
      <DataQuery queryData={queryData} isShowLoading={false}>
        {(data) => {return <></>;}
      </DataQuery>
  );
};
export default Toggle;