I am having a problem retrieving data from or writing to my database. The initialization of the table is successful but if I put any other function I get the following warning and the code doesn't work
    export const getDataFromDB = async () => {
  const dispatch = useDispatch();
  try {
    const db = await getDB();
    await db.transaction(async tx => {
      await tx.executeSql(
        'SELECT UserName, Password, RememberMe, MapView, DrawEdits, NetworkIP, Port, Auth FROM UsersInformation',
        [],
        (tx, results) => {
          console.log('Database readed');
          var len = results.rows.length;
          if (len > 0) {
            let item = results.rows.item(0);
            dispatch(setUsername(item.UserName));
            dispatch(setPassword(item.Password));
            dispatch(setRememberMe(item.RememberMe));
            dispatch(setMapView(item.MapView));
            dispatch(drawEdits(item.DrawEdits));
            dispatch(networkIp(item.NetworkIP));
            dispatch(networkPort(item.Port));
            dispatch(networkAuth(item.Auth));
          }
        },
      );
    });
  } catch (error) {
    console.log(error.message);
  }
};
The error is the following
Possible Unhandled Promise Rejection (id: 3): Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
- You might have mismatching versions of React and the renderer (such as React DOM)
 - You might be breaking the Rules of Hooks
 - You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
 - You might have mismatching versions of React and the renderer (such as React DOM)
 - You might be breaking the Rules of Hooks
 - You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.