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***
> 
> 
>
For those who have the same problem in **Jetbrains Rider** :

1. **Install OpenJDK 11** (**Microsoft's OpenJDK 11** seems to be better) as mentioned by @themelis
2. Press **Ctrl + Shift + A** and search **MSBuild global properties** or go to **File > Settings > Build, Execution, Deployment > Toolset and Build**
3. **Edit** the **MSBuild global properties** and **add** the following property:

`Name: **JavaSdkDirectory**
Value: {**OpenJDK installation directory**} (mine is **C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot**)`

[![enter image description here](https://i.stack.imgur.com/3SrCU.png)](https://i.stack.imgur.com/3SrCU.png)

4. **Save** and **Enjoy**!