We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import AppStorages from '../../Storages/AppStorage' const Amap = (props) => { const UI = useStore(UIStorages) const App = useStore(AppStorages) let _AMap, _map = null let i = 0; // ...somecode return <> {console.log(`刷新:${ i+1 }`)} <APILoader akay=""> <div style={{ width: '100%', height: document.body.clientHeight - 154 }}> <Map zoom={8} zooms={[2, 20]} center={[]} onComplete={() => { _map.panTo([], 800) _map.setZoom(13, false, 1500) }} onZoomEnd={() => { if (_map.getZoom() > 14) { if(App.Amap_type === 0){ console.log("0") App.setAmap_type(1) } } else { if(App.Amap_type === 1){ console.log("1") App.setAmap_type(0) } } }} > // ...somecode
订阅已开启memo,但是执行到 App.setAmap_type(1) 会 console.log() 输出 "刷新:1",i 都是 1.
The text was updated successfully, but these errors were encountered:
在这里写个更具体的复现 demo 吧:
https://codesandbox.io/s/github/awmleer/reto-demo/tree/master/?fontsize=14
Sorry, something went wrong.
在这里写个更具体的复现 demo 吧: https://codesandbox.io/s/github/awmleer/reto-demo/tree/master/?fontsize=14
久等了! 这是 demo: https://codesandbox.io/s/react-forked-dgqlhf?file=/Templates/Home/index.js
https://dgqlhf.csb.app
好像确实存在这个问题,这个例子会更好理解一些 https://codesandbox.io/s/react-forked-n012dl?file=/App.js:123-381
如果使用 AppContext.Provider,不会渲染两次 https://codesandbox.io/s/react-forked-vq092y?file=/App.js
No branches or pull requests
订阅已开启memo,但是执行到 App.setAmap_type(1) 会 console.log() 输出 "刷新:1",i 都是 1.
The text was updated successfully, but these errors were encountered: