GeekyAnts / GeekyAnts/unitools

[DOCS]: useRouter should be imported as a named export, not a default export

Open
#15 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
38
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### Description

The documentation for `@unitools/router` incorrectly shows `useRouter` as a default export. However, in the latest version, `useRouter` is a named export. This discrepancy is causing confusion and errors.

### Steps to Reproduce

1. Follow the documentation at [unitools router documentation](https://unitools.geekyants.com/packages/router/) to import `useRouter` as a default export:
```tsx
import useRouter from '@unitools/router';

2. Attempt to use the `useRouter` hook in a component.

### Expected Behavior

The `useRouter` hook should be imported and used without any errors.

### Actual Behavior

The following error is thrown:
```
TypeError: _unitools_router__WEBPACK_IMPORTED_MODULE_16__["default"] is not a function
```

### Additional Information

Here is the correct way to import `useRouter`:
```tsx
import { useRouter } from '@unitools/router';
```

### Environment

- `@unitools/router` version: 0.0.6
- Node.js version: 22
- Operating System: windows 10

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the @unitools/router documentation linked in the issue and inspect the import example for useRouter. Done means the documentation shows the named-export form, `import { useRouter } from '@unitools/router';`, instead of the default import.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.