react-filter-by-url
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A React library to update API Url with query parameters by looking at query parameters in the address bar of browser.", | ||
@@ -10,0 +10,0 @@ "main": "dist/cjs/index.js", |
@@ -13,3 +13,3 @@  | ||
[](https://codesandbox.io/s/q4szr7?file=/src/DemoList.tsx) | ||
[](https://codesandbox.io/s/elegant-keller-dpjp3e?file=/src/App.tsx) | ||
@@ -44,28 +44,5 @@ Live demo: https://react-filter-by-ulr-demo.vercel.app/list | ||
``` | ||
yarn add react-filter-by-url react-router-dom | ||
yarn add react-filter-by-url | ||
``` | ||
We use `react-router-dom` under the hood, so in the root file `index.tsx`, wrap the `<app />` with `<BrowserRouter>`: | ||
```jsx | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App' | ||
import reportWebVitals from './reportWebVitals' | ||
import { BrowserRouter as Router } from 'react-router-dom' | ||
const root = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
) | ||
root.render( | ||
<React.StrictMode> | ||
<Router> | ||
<App /> | ||
</Router> | ||
</React.StrictMode> | ||
) | ||
``` | ||
### Implementation | ||
@@ -118,3 +95,3 @@ | ||
Try toggling around the filters in the UI by using `handleSelectFilter` to update the URL query parameters.: | ||
Try toggling around the filters in the UI by using `handleSelectFilter` to update the URL query parameters: | ||
@@ -121,0 +98,0 @@ ```jsx |
16689
130