You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to enter the draw object with react hooks but an error message 'getAll is not function' is displayed
As the correct reference should be made, is its example with react component, as I can replicate it with react hooks, I have used the useRef () but it still does not work
Hi @pulnec , I know this issue is old but I just had the same problem and solved it by using useState instead of useRef. React will throw an error if you try to use useRef with the DrawControl.
I am trying to enter the draw object with react hooks but an error message 'getAll is not function' is displayed
As the correct reference should be made, is its example with react component, as I can replicate it with react hooks, I have used the useRef () but it still does not work
`<Map
style="mapbox://styles/mapbox/streets-v9"
containerStyle={{
height: '100vh',
width: '100vw'
}}>
<DrawControl
ref={(drawControl) => { this.drawControl = drawControl; }}
/>
//...
handleButtonClick() {
this.drawControl.draw.getAll(); // Or any other API method
}`
in hooks
cons drawControl = useRef() ??
The text was updated successfully, but these errors were encountered: