1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-24 00:01:36 +01:00

Add warning about using <ForisForm /> component in plugins.

This commit is contained in:
Bogdan Bodnar 2020-01-17 12:21:21 +01:00
parent e7e389e843
commit 532acf9d86
No known key found for this signature in database
GPG Key ID: 49E4169AD3CA42B0
2 changed files with 23 additions and 1 deletions

View File

@ -16,3 +16,20 @@ tagged `beta`. Versions names are based on commit SHA, e.g.
unnecessary version unnecessary version
3. Create a merge request from `dev` to `master` branch 3. Create a merge request from `dev` to `master` branch
4. New version should be published automatically 4. New version should be published automatically
## Manually managed dependencies
Because of `<ForisForm />` component it's required to use exposed `ReactRouterDOM`
object from `react-router-dom` library. `ReactRouterDOM` is exposed by
[reForis](https://gitlab.labs.nic.cz/turris/reforis/reforis/blob/master/js/webpack.config.js).
It can be done by following steps:
1. Setting `react-router-dom` as `peerDependencies` and `devDependencies` in `package.json`.
2. Adding the following rules to `externals` in `webpack.conf.js` of the plugin:
```js
externals: {
...
"react-router-dom": "ReactRouterDOM",
}
```

View File

@ -73,7 +73,12 @@ ForisForm.defaultProps = {
disabled: false, disabled: false,
}; };
/** Serves as HOC for all foris forms components. */ /** Serves as HOC for all foris forms components.
*
* As `<Prompt />` from `react-router-dom` is used in this component then it required to
* use exposed `ReactRouterDOM` object from `react-router-dom` library which is exposed by reForis.
* See README for more information.
* */
export function ForisForm({ export function ForisForm({
ws, ws,
forisConfig, forisConfig,