Get Default store id of website by website id Magento 2.

Magento contains Multi-store functionality for a single website.

Let’s consider Single website has three stores for different presentation,
1. English(store id 1),
2. French(store id 2 Default store),
3. Spanish(store id 3)

When you required default store id, In our case the default store is French,
We need to fetch store id as 2 for default using website id,

You have to fetch current website default store id using programmatically,
You can fetch the current website default store id by the below code snippet.

<?php

namespace Rbj\MyWebsite\Model;

use Magento\Store\Model\StoreManagerInterface;

class Config
{
    /**
     * @var StoreManagerInterface
     */
    private $storeManager;

    public function __construct(
        StoreManagerInterface $storeManager
    ) {
        $this->storeManager = $storeManager;
    }

    /**
     * Get store id by website id
     *
     * @param int $id
     * @return id
     */
    public function getStoreIdByWebsiteId(int $websiteId)
    {
        $storeId = $this->storeManager->getWebsite($websiteId)->getDefaultStore()->getId();
        return $storeId;
    }
}

Call function,
echo $this->getStoreIdByWebsiteId(1);

Output
2 (French is default store and its id 2)