Question: I am new to VB.NET and trying to develop a GIS system. There is a txt file like this.

![the data file](https://i.stack.imgur.com/5yQV9.png)

I want to read the longitude and latitude, but I don't know how to read them into two different arrays. Also, there is "# -b" line in the file, I don't know how to skip these lines.  

I use code like this, but it doesn't work.

```
FileOpen(1, "coastline.dat", OpenMode.Input)
            Input(1, longtitude)
            Do While Not EOF(1)
                Input(1, latitude)
                longtitude = latitude = ""
                Do Until longtitude = "#" Or EOF(1)
                    i = 0
                    Input(1, longtitude)
                    Input(1, latitude)
                    x(i) = (Val(longtitude) + 180) * Me.Width / 360
                    y(i) = (90 - Val(latitude)) * Me.Height / 180
                    i = i + 1
                Loop
                count = i - 1
                For i = 0 To count
                    map.DrawLine(pen1, x(i), y(i), x(i + 1), y(i + 1))
                Next i
            Loop
            FileClose()

```

Answer: 
You can use the [useEffect](https://reactjs.org/docs/hooks-effect.html) hook:

```
const Dropzone = () => {

    const [dropzoneFiles, setDropzoneFiles] = useState([]);
    const [dropzoneIsLoading, setDropzoneIsLoading] = useState(false);

    const onDropAccepted = useCallback(
        acceptedFiles => {
            let someFiles = ['a', 'b'];

            // How to use callback?
            setDropzoneFiles(someFiles);

        }
    );

    useEffect(() => {
       if (dropzoneFiles) {
          setDropzoneIsLoading(true);
       }

    }, [dropzoneFiles])

    const {getRootProps, getInputProps} = useDropzone({
        onDropAccepted,
        onDropRejected,
        multiple: true
    });
    }

export default Dropzone;

```
The answers you will find online will point you to using `useEffect`, but this is simply a coverup for a bigger underlying issue.

As mentioned in [this post by Lenz Weber](https://github.com/reactjs/rfcs/issues/98#issuecomment-479188615) as to why there is no callback in `useState()`:

> 
> Because it invokes a thought pattern that may very well be an antipattern with hooks.
> 
> 
> With hooks, you are writing code more declarative than imparative.
> 
> 
> 

I recommend reading the whole thread as there is great insight in the discussion.

### What to do instead?

If you use Redux's `useReducer` and dispatch: through a Reducer, you can, in one operation, set the dropZoneFiles and isLoading to true without being interrupted in the middle.

A lot of folks are not fond of Redux, but it exists precisely for this kind of situation.

Also, Dan Abramov from Facebook (big promoter of hooks) himself has frequently mentioned ([here for example](https://overreacted.io/how-are-function-components-different-from-classes/)) that not every component should be immediately migrated to hooks, especially because best-practices need to solidify; I myself prefer Class Components when dealing with complex components.