# @databyss-org/reach-router

> Next generation Routing for React.

Latest version **1.3.4-b1** (published 2020-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @databyss-org/reach-router
pnpm add @databyss-org/reach-router
yarn add @databyss-org/reach-router
bun add @databyss-org/reach-router
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.4-b1 |
| Published | 2020-12-18 |
| First published | 2020-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 206 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ryan Florence |
| Maintainers | pzhine |
| Keywords | react, react router |

## Links

- npm: https://www.npmjs.com/package/@databyss-org/reach-router
- Repository: https://github.com/databyss-org/reach-router
- Homepage: https://github.com/reach/router#readme
- Issues: https://github.com/reach/router/issues
- npm.io page: https://npm.io/package/@databyss-org/reach-router

## Dependencies (4)

- [invariant](https://npm.io/package/invariant.md) ^2.2.3
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.1
- [create-react-context](https://npm.io/package/create-react-context.md) 0.3.0
- [react-lifecycles-compat](https://npm.io/package/react-lifecycles-compat.md) ^3.0.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.3.4-b1 (latest) — 2020-12-18

## README

# @databyss-org/reach-router
A fork of [@reach/router](https://github.com/reach/router) that permits usage without the focus control.

## The problem
By default, Reach Router is designed to control the focus on route changes to comply with certain A11Y expectations. For example, when a user navigates to a new route, a screen reader would need the focus to transition to the newly shown route. If it didn't, the screen reader would not be able to correctly report and navigate the new content. To facilitate this, Reach Router wraps every `<Router>` and child route component in a `<div>`. This can obviously cause problems with some layouts, especially flex layouts.

## The solution, part 1
As outlined in [this issue](https://github.com/reach/router/issues/63#issuecomment-457840121), Reach allows you to override the wrapping component described above. If you supply a React Fragment as the `component` property and set the `primary` property on the `<Router>` component, the wrapper is not rendered around the route children components. However, the wrapper is still rendered around the `<Router>` component.

## The solution, part 2
This fork incorporates [PR #104](https://github.com/reach/router/pull/104/files), which normalizes the wrapping behavior between the `<Router>` component and its children.

## Suggested usage
In Databyss, we don't need Reach to manage the focus transitions during route changes. Where necessary, we update the focus. So we want to disable the focus management and component wrapping everywhere the `<Router>` component is used. We have one library file, `NavigationProvider.js` that composes the Reach `<Router>` component with the props described above set to disable focus management. Then we import that component in our app when we want to use a router.

```js
// NavigationProvider.js
import { Router as ReachRouter } from '@databyss-org/reach-router'
const RouteWrapper = ({ children }) => <>{children}</>
export const Router = ({ children, ...others }) => (
  <ReachRouter primary={false} component={RouteWrapper} {...others}>
    {children}
  </ReachRouter>
)
```

---
_Source: https://npm.io/package/@databyss-org/reach-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
