0

One library exports its function in such way:

export {
    default,
    sitemapBuilder,
    routesParser,
    pathsFilter,
    paramsApplier,
} from './lib';

I would like to import them by single line:

import { Sitemap, routesParser } from 'react-router-sitemap';

But it doesn't work, Sitemap and routesParser are undefined.

From their guide:

import Sitemap from 'react-router-sitemap';
import { routesParser as parseRoutes } from 'react-router-sitemap';

Sitemap is class
routesParser is function

Actual result:

Sitemap loaded ok
parseRoutes is undefined

Lesha Pipiev
  • 3,251
  • 4
  • 31
  • 65

2 Answers2

0

Try like this to import in single line

import Sitemap, { routesParser } from 'react-router-sitemap';

Jyothi Babu Araja
  • 10,076
  • 3
  • 31
  • 38
0

Import everything like below,

import * as parseRoutes from 'react-router-sitemap';
eg: console.log(parseRoutes.sitemapBuilder());

Or Import something like below,

import { sitemapBuilder, routesParser } from 'react-router-sitemap';