'I want to translate .tsx into plain javascript react js code

  1. This is my .tsx code
    import { getServerSideSitemap, ISitemapField } from "next-sitemap";
    
    export const getServerSideProps: GetServerSideProps = async (ctx) =>
    {   
    const response = await
    fetch(`${"https://blog-app-hot.herokuapp.com/api/"}articles/home/tv`)
    const articles: any[] = await response.json()
    
    
    
      const fields: ISitemapField[] = articles.map(article => ({
        loc: `https://www.hotseatmag.com/article/${article.slug}`,
        lastmod: new Date().toISOString(),
    
      }))
    
      return getServerSideSitemap(ctx, fields) } 
    export default function sitemap() { } 

Question : I want to translate this code in plain react js javascript , I tried different solution but I'm getting error on both of them.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source