diff --git a/package.json b/package.json
index bfd18ac..87ebd16 100644
--- a/package.json
+++ b/package.json
@@ -170,8 +170,8 @@
"lint-staged"
],
"devDependencies": {
- "@babel/cli": "^7.8.3",
- "@babel/core": "^7.8.3",
+ "@babel/cli": "^7.8.4",
+ "@babel/core": "^7.8.4",
"@babel/plugin-external-helpers": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
@@ -184,53 +184,52 @@
"@babel/plugin-transform-react-constant-elements": "^7.8.3",
"@babel/plugin-transform-react-inline-elements": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
- "@babel/preset-env": "^7.8.3",
+ "@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.8.3",
- "@rollup-umd/documentation": "^2.0.11",
+ "@rollup-umd/documentation": "^2.0.13",
"@rollup-umd/rollup": "^1.1.1",
"@rollup-umd/ncu": "^1.0.9",
- "@semantic-release/changelog": "^3.0.6",
- "@semantic-release/git": "^8.0.0",
- "@semantic-release/github": "^6.0.1",
- "@semantic-release/npm": "^6.0.0",
+ "@semantic-release/changelog": "^5.0.0",
+ "@semantic-release/git": "^9.0.0",
+ "@semantic-release/github": "^7.0.3",
+ "@semantic-release/npm": "^7.0.2",
"@yeutech-lab/documentation": "^2.0.2",
"babel-eslint": "^10.0.3",
- "babel-jest": "^24.9.0",
+ "babel-jest": "^25.1.0",
"babel-loader": "^8.0.6",
"babel-merge": "^3.0.0",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-array-includes": "^2.0.3",
"babel-plugin-dynamic-import-node": "^2.3.0",
- "babel-plugin-inline-react-svg": "^1.1.0",
+ "babel-plugin-inline-react-svg": "^1.1.1",
"babel-plugin-react-transform": "^3.0.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
- "cz-conventional-changelog": "^3.0.2",
+ "cz-conventional-changelog": "^3.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
- "eslint-plugin-import": "^2.20.0",
+ "eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
- "eslint-plugin-react": "^7.17.0",
+ "eslint-plugin-react": "^7.18.3",
"exports-loader": "^0.7.0",
"istanbul-api": "^3.0.0",
"istanbul-reports": "^3.0.0",
- "jest-cli": "^24.9.0",
+ "jest-cli": "^25.1.0",
"jest-sonar-reporter": "^2.0.0",
- "lint-staged": "^9.5.0",
+ "lint-staged": "^10.0.7",
"pre-commit": "^1.2.2",
"raf": "^3.4.1",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-router": "^5.1.2",
- "react-router-dom": "^4.2.2",
"react-test-renderer": "^16.12.0",
- "semantic-release": "^16.0.1",
+ "semantic-release": "^17.0.2",
"toctoc": "^0.3.2",
"webpack": "^4.41.5"
},
"dependencies": {
- "@babel/runtime": "^7.8.3",
+ "@babel/runtime": "^7.8.4",
"@yeutech-lab/tree-operations": "^1.0.2",
"core-js": "^3.6.4",
"deepmerge": "^4.2.2",
@@ -243,7 +242,7 @@
"peerDependencies": {
"react": "*",
"react-dom": "*",
- "react-router-dom": "*"
+ "react-router": "*"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
@@ -356,7 +355,7 @@
"coverageThreshold": {
"global": {
"statements": 95,
- "branches": 94,
+ "branches": 93,
"functions": 91,
"lines": 93
}
diff --git a/src/Link.js b/src/Link/Link.js
similarity index 84%
rename from src/Link.js
rename to src/Link/Link.js
index 6f29e98..a57672f 100644
--- a/src/Link.js
+++ b/src/Link/Link.js
@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { withRouter } from 'react-router-dom';
-import makeRoutes from './makeRoutes';
-import matchParamsPath from './matchParamsPath';
+import makeRoutes from '../makeRoutes';
+import matchParamsPath from '../matchParamsPath';
/**
* @name Link
@@ -37,8 +36,44 @@ import matchParamsPath from './matchParamsPath';
* );
* ```
*
+ * @example
+ *
+ * Then call that link in your application:
+ *
+ * ```javascript
+ * Home
+ * ```
+ *
+ * @example
+ * It can work with any navigation engine, if you don't want the Link to detect react-router from the context, just pass the props `push` with the navigate function:
+ * If you want to preload the page, `to` and `routesMap` (already created in the application Link.js) are necessary
+ * ```javascript
+ * navigate('home')} />
+ * ```
+ *
+ * @example
+ *
+ * It can also work with react-native, but since they use `onPress` massively instead of `onClick`, you need to remap the props to `onClick` before:
+ *
+ * ```javascript
+ * // remap onClick to onPress
+ * const Button = ({
+ * t,
+ * onClick,
+ * onPress,
+ * ...rest
+ * }) => (
+ *