About useChain hook

This code works perfectly;

import { useChain } from "react-moralis";

function Chains() {
  const { switchNetwork, chainId, chain, account } = useChain();
  return (
      <button onClick={() => switchNetwork("0x1")}>Switch to Ethereum</button>
      <p>Current chainId: {chainId}</p>

But when i try to {chain.name} instead of {chainId} whole React app has been crashing and getting this error;
Uncaught TypeError: Cannot read properties of null (reading β€˜name’)

What is the problem? Thanks.

It seems there is no data to read under chain.name. If you want a chain name, I think u can just add {chain}