rahul
rahul

Reputation: 7663

useBaseName is not available in history npm package

I am using history package for getting the useBaseName like this

import { useBasename } from "history";

But it is coming as undefined. I am not sure what I am doing wrong here.

My history package version is 4.7.2

Upvotes: 1

Views: 928

Answers (1)

Patrick Hund
Patrick Hund

Reputation: 20276

useBasename has been removed from history version 4, it is only available in earlier versions.

In the current version of history, you can set the base name as an option when you create a history, e.g.:

const history = createHistory({
  basename: "/the/base"
})

See also: history documentation

Upvotes: 2

Related Questions