0.4.0 • Published 4 months ago

react-router-v5-v6-bridged-features v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

React Router v6 Hooks/Components for v5 Apps

A package providing React hooks/components from React Router v6 that can be seamlessly used in React applications running on React Router v5. Enable your v5 applications to leverage the power of v6 hooks without the need for a complete upgrade.

Table of Contents

Installation

npm install react-router-v5-v6-bridged-features

Usage

useNavigate

The useNavigate hook provides a convenient way to navigate within your React application using React Router v6 hooks while maintaining compatibility with v5.

import { useNavigate } from "react-router-v5-v6-bridged-features";

const ExampleComponent = () => {
  const navigate = useNavigate();

  const handleButtonClick = () => {
    // Navigate to a specific route
    navigate("/dashboard");
  };

  return <button onClick={handleButtonClick}>Go to Dashboard</button>;
};

Navigate Component

The Navigate component is a component-based version of the useNavigate hook.

import { Navigate } from "react-router-v5-v6-bridged-features";

const ExampleComponent = () => {
  return <Navigate to="/dashboard" replace />;
};

useSearchParams

The useSearchParams hook provides an easy way to manage and update URL search parameters, supporting v6 hooks in v5 applications.

import { useSearchParams } from "react-router-v5-v6-bridged-features";

const ExampleComponent = () => {
  const { searchParams, setSearchParams } = useSearchParams();

  const handleInputChange = event => {
    setSearchParams(prevSearchParams => {
      // Perform transformations on the search parameters
      prevSearchParams.set("query", event.target.value);
      return prevSearchParams;
    });
  };

  return (
    <input
      type="text"
      value={searchParams.get("query") ?? ""}
      onChange={handleInputChange}
    />
  );
};

Contributing

We welcome contributions! If you find any issues or have suggestions for improvement, please open an issue or create a pull request.

License

This project is licensed under the MIT License.

acorn-jsxababacornajvansi-colorsansi-escapesansi-regexansi-stylesacorn-walkargparseanymatcharr-diffarr-unionacorn-globalsaria-queryarr-flattenarray-uniquearray-equalarray-includesarray.prototype.findlastindexarray-buffer-byte-lengtharray.prototype.flatassert-plusasn1ast-types-flowarray.prototype.tosortedastral-regexarray.prototype.flatmapassign-symbolsarraybuffer.prototype.sliceasyncroat-least-nodeaws-sign2atobaws4asynckitasynciterator.prototypeaxobject-queryaxe-coreavailable-typed-arraysbabel-plugin-annotate-pure-callsbabel-jestbabel-plugin-macrosbabel-plugin-jest-hoistbabel-plugin-polyfill-corejs2babel-plugin-dev-expressionbabel-eslintbabel-plugin-istanbulbabel-plugin-polyfill-regeneratorbabel-plugin-polyfill-corejs3balanced-matchbasebinary-extensionsbabel-plugin-transform-rename-importbrace-expansionbrowser-process-hrtimebabel-preset-jestbabel-preset-current-node-syntaxbcrypt-pbkdfbracesbrowserslistbuffer-frombs-loggerbrowser-resolvebuiltin-modulescache-basecallsitescamelcasebserbytes-ieccaniuse-litecaselesschokidarchalkci-infocli-cursorcall-bindclass-utilscli-spinnerscapture-exitclonecocliuicollect-v8-coveragecli-widthchardetcolor-convertcolor-namecollection-visitcomponent-emittercombined-streamcommondircopy-descriptorcore-js-compatconcat-mapcommanderconvert-source-mapcore-util-isconfusing-browser-globalscssomcssstylecosmiconfigcsstypedebugdata-urlsdecode-uri-componentdamerau-levenshteindecamelizedashdashdeep-isdeepmergecross-spawndefaultsdefine-propertydelayed-streamdefine-propertiesdetect-newlinedefine-data-propertydiff-sequencesdomexceptionecc-jsbndequalelectron-to-chromiumend-of-streamenquirererror-exdoctrineemoji-regexes-abstractes-iterator-helperses-to-primitivees-shim-unscopableses-set-tostringtagescaladeesbuildeslint-config-react-appescodegeneslint-config-prettierescape-string-regexpeslinteslint-module-utilseslint-import-resolver-nodeeslint-plugin-flowtypeeslint-plugin-jsx-a11yeslint-plugin-importeslint-plugin-react-hookseslint-plugin-prettiereslint-scopeeslint-plugin-reacteslint-utilsespreeeslint-visitor-keysestree-walkeresqueryexitestraverseexec-shesutilsesrecurseexecaesprimaexpand-bracketsextsprintfextend-shallowextendfast-deep-equalfast-diffexpectfast-levenshteinexternal-editorfast-globfast-json-stable-stringifyextglobfiguresfastqfb-watchmanfile-entry-cachefind-cache-dirforever-agentform-datafor-infill-rangefs.realpathfind-upfor-eachflat-cacheflattedfunction-bindfs-extrafunction.prototype.nameget-caller-filefunctional-red-black-treefunctions-have-namesget-intrinsicfragment-cacheget-stdingensyncget-package-typeget-valueget-streamget-symbol-descriptionglobglobalyzerglobrexgetpassglob-parentglobbyglobalsglobalthisgopdgraceful-fshar-validatorhas-property-descriptorsgrowlyhas-protohas-bigintshas-flaghas-valueshar-schemahtml-encoding-snifferhas-symbolshas-tostringtaghas-valuehosted-git-infohistoryhoist-non-react-staticshasowniconv-liteimport-localhttp-signatureimport-freshhtml-escaperignoreinheritshuman-signalshumanize-durationinquirerinflightinternal-slotinterpretip-regexis-array-bufferis-bigintis-accessor-descriptoris-binary-pathis-arrayishis-async-functionimurmurhashis-bufferis-date-objectis-data-descriptoris-ciis-core-moduleis-callableis-dockeris-descriptoris-boolean-objectis-fullwidth-code-pointis-extendableis-extglobis-moduleis-finalizationregistryis-generator-functionis-generator-fnis-globis-mapis-numberis-negative-zerois-regexis-plain-objectis-shared-array-bufferis-setis-number-objectis-referenceis-typed-arrayis-weakmapis-stringis-symbolis-interactiveis-wslisarrayis-weaksetis-weakrefis-streamisstreamisobjectis-windowsis-typedarrayistanbul-lib-coverageiterator.prototypeisexeistanbul-lib-instrumentistanbul-lib-reportjest-changed-filesistanbul-lib-source-mapsistanbul-reportsjestjest-docblockjest-clijest-diffjest-haste-mapjest-environment-jsdomjest-configjest-get-typejest-jasmine2jest-eachjest-regex-utiljest-message-utiljest-leak-detectorjest-environment-nodejest-mockjest-matcher-utilsjest-pnp-resolverjest-resolve-dependenciesjest-runnerjest-resolvejest-utiljest-snapshotjest-runtimejest-serializerjest-watch-typeaheadjest-workerjest-watcherjest-validatejsbnjpjsjs-tokensjsescjsdomjson-schema-traversejson-schemajsprimjson-stringify-safejson5json-stable-stringify-without-jsonifykleurjson-parse-even-better-errorsjsx-ast-utilsjs-yamllanguage-subtag-registrylevenkind-oflanguage-tagslilconfigjsonfilelevnlocate-pathlodash.sortbylodash.mergelodash.debouncelodashlolexlodash.memoizelog-symbolslru-cachelower-casemakeerrorlog-updatemake-errormap-cachemerge-streamloose-envifymake-dirlines-and-columnsmap-visitmicromatchmagic-stringmime-typesmime-dbmimic-fnmkdirpminimatchmute-streammrimixin-deepmerge2nanomatchnanoidnanospinnerminimistmsnice-trynode-releasesnatural-comparenormalize-pathnode-int64oauth-signnpm-run-pathnode-notifierobject-assignnormalize-package-dataobject-inspectnwsapiobject-keysobject.assignobject.hasownno-caseobject.entriesobject.fromentriesobject.groupbyobject.valuesobject-visitonceobject-copyobject.pickoraonetimep-limitp-each-seriesp-finallyos-tmpdiroptionatorp-tryp-locateparse5parent-modulepath-is-absolutepath-parseparse-jsonpath-keypascalcasepath-to-regexppascal-casepath-typepnpicomatchpath-existspkg-dirprettierperformance-nowpicocolorspiratesposix-character-classesprelude-lspretty-formatprogress-estimatorprop-typespumpprettier-linter-helpersprogresspromptsreact-ispslqsrandombytespunycodequeue-microtaskread-pkgread-pkg-upreaddirprechoirrealpath-nativereact-routerregenerateregenerator-runtimeregenerator-transformreflect.getprototypeofregex-notregexpu-coreregenerate-unicode-propertiesrepeat-elementrepeat-stringremove-trailing-separatorregjsparserrequire-directoryrequest-promise-nativerequest-promise-coreresolve-fromresolve-cwdregexp.prototype.flagsrequestregexppresolve-pathnamerestore-cursorrequire-main-filenameresolveretrollup-plugin-sourcemapsrollup-plugin-terserreusifyresolve-urlrimrafrollup-pluginutilsrsvprun-asyncrolluprun-parallelrollup-plugin-typescript2sadesafe-buffersafe-regexsafer-buffersaxesschedulerrxjsserialize-javascriptsemverset-function-lengthsafe-regex-testsafe-array-concatset-blockingshebang-commandset-function-namesaneshebang-regexside-channelset-valueshellwordsshelljssignal-exitsnapdragon-nodesnapdragonsource-map-resolvesource-mapslashsisteransisource-map-urlsnapdragon-utilslice-ansispdx-expression-parsespdx-correctsourcemap-codecsource-map-supportsshpkstack-utilsstatic-extendspdx-exceptionsspdx-license-idsstealthy-requirestring.prototype.trimstartsprintf-jsstring.prototype.trimendstring.prototype.matchallsplit-stringstring-widthstring.prototype.trimstring-lengthstrip-ansistrip-final-newlinestrip-json-commentssupports-colorsupports-hyperlinkssymbol-treeterminal-linktest-excludestrip-eofstrip-bomtablesupports-preserve-symlinks-flagtext-tabletiny-warningthroughterserthroattmpltiny-globto-object-pathto-fast-propertiesto-regex-rangetough-cookietr46to-regextiny-invarianttunnel-agenttweetnacltmptsutilstsconfig-pathstype-detecttype-festtyped-array-buffertyped-array-lengthtyped-array-byte-offsetts-jesttypedarray-to-buffertyped-array-byte-lengthunicode-canonical-property-names-ecmascripttype-checkundici-typesunicode-match-property-value-ecmascriptunicode-match-property-ecmascriptunion-valueuniversalifyunset-valueurixuri-jsupdate-browserslist-dbunicorn-magicunbox-primitivev8-compile-cacheuuiduseverrorwalkerunicode-property-aliases-ecmascriptw3c-hr-timewcwidthw3c-xmlserializerwebidl-conversionsvalidate-npm-package-licensev8-to-istanbulwhich-boxed-primitivevalue-equalwhichwhich-collectionwhatwg-mimetypewhich-typed-arraywhatwg-urlwhich-builtin-typewhich-modulewhatwg-encodingwrap-ansiword-wrapwrappywswrite-file-atomicxml-name-validatoryargsyallisty18nyargs-parserxmlcharswriteyaml
0.4.0

4 months ago

0.3.0

4 months ago

0.2.0

4 months ago

0.1.0

4 months ago