Question: In Next.js during SSR I get user object from session and ip address of client that performed request.

```
 return {
   props: {
     user,
     ipAddress,
   },
 };

```

User can exist but it can also be undefined if request is unauthenticated. I want to be able to:

1. If user is authenticated run react-query hook that uses `user.id` and fetches user settings.
2. If user is not authenticated provide default settings values that I have stored in config file.

```
const LandingPage = ({
  user,
  ipAddress,
}: LandingPageProperties): JSX.Element => {

  // User exist

  const { config } = useGetOwnSettingsQuery(
    {
      endpoint: 'http://localhost:3000/api/graphql',
      fetchParams: {
        headers: setFetchHeaders(),
      },
    },
    { userWhere: { id: user?.id } },
  );

  // User does not exist

  imported config from config.ts

  return <LandingPageMap className="map" { config goes here }/>;
};

```

I really dont have good idea how to perform what I want, hooks do not like if I call them inside useEffect and they dont like if I return early to check if user exist.

Answer: 
Installing Microsoft's [OpenJDK 11](https://learn.microsoft.com/en-us/java/openjdk/download) did the job for me.

> 
> *You may notice that Visual Studio installs a version of Microsoft*
> *OpenJDK, **however, you need to install the Microsoft OpenJDK 11***
> 
> 
>
When I installed VS2022 preview 4, my configuration became `C:\Program Files\Microsoft\jdk-11.0.10.9-hotspot`

This can be fixed for you if you run the `maui-check` command (if you installed that component during visual studio installation).

If you don't have the `maui-check` tool, you can get it by running the `dotnet tool install -g Redth.Net.Maui.Check` command

Maybe you skipped a step during installation and that's why you get the error.