Filter data with check box input
Hello, I am interested in how I could filter the data on the check box and, by clicking on the check box, place that data instead of the existing ones in labelsData. I work in react globe gl. I want to insert several check boxes and have the initial data set as labelsData, and after each click on the box adds that filtered data or subtracts on uncheck?
How do I get the data from labelsData outside the Globe component, take it and replace it on some condition with new data.
Just like this example: https://codesandbox.io/s/quirky-wave-cpfs1?file=/index.html , the only thing I don't know is how to access this property in this function in react globe function clearArcs() { Globe.labelsData([]); //how to read Globe.labelsData in React GlobeGL component? console.log(Globe.labelsData); }
@Ivann-2612 this is a question perhaps more appropriately placed in the react-globe.gl repo. But in any case, in React you're already passing the labelsData as prop into the component, so you have it there readily available for reading and manipulation.
Yes, I want to use the function as in the example to set the object to be empty or to set the same object to the reverse button
You should be able to do exactly that using useState hooks. But it's really more of a React question at this point.
one more question, is there any option to display different data on the globe at a certain altitude, for example when the distance is greater and the altitude is over 4, to see the numbers of the stadiums on the countries and when the altitude is below 4 to see all the stadiums in the countries?
I managed to solve the above question, on the if else condition I set setState([]) when I want no data to be seen and setState(someData) in the opposite case, the useState hook is in question