Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render() is not getting called #101

Open
cullsin opened this issue Mar 16, 2020 · 1 comment
Open

render() is not getting called #101

cullsin opened this issue Mar 16, 2020 · 1 comment

Comments

@cullsin
Copy link

cullsin commented Mar 16, 2020

Hello,

Seems like render() method is not getting called and I can see a empty url in the sitemap. Please suggest what I am missing over here.

sitemap-generator.js

  require('@babel/register')({
    extends: './.babelrc'
  });

  window = {
    location : {
      origin : 'localhost',
      search : '/'
    },
    addEventListener : function() {}
  }

  document = {
    addEventListener : function() {}
  }   

  const router = require('./src/containers/App/path.js').testRoute;
  const Sitemap = require('react-router-sitemap').default;

  function generateSitemap() {
    return new Sitemap(router)
      .build('localhost')
      .save('./public/sitemap.xml');
  }
  generateSitemap();

Path.js

  /** @format */

  import React from 'react';
  import { Route } from 'react-router';
  import '../../config'
  import '../../utils/i18nHelper';
  import '../../i18n';

  export class testRoute extends React.Component {
    render() {
      return  (  
        <Route>
          <Route path='/' />
          <Route path='/about' />
          <Route path='/projects' />
          <Route path='/contacts' />
          <Route path='/auth' />
          <Route exact path={this.props.t('lang_route:campaignFlow.subscriptionMessage')} />
        </Route>
      )  
    } 
  }
@Matzu89
Copy link
Contributor

Matzu89 commented Jul 5, 2020

Hi @cullsin,

Please check the example here and export your routes as such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants