Skip to content

Commit 94ddeb2

Browse files
himdelHyperkid123
authored andcommitted
common - README.md
example interface
1 parent 6359e81 commit 94ddeb2

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/common/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[![Data Driven Form logo](images/logo.png)](https://data-driven-forms.org/)
2+
3+
# `@data-driven-forms/common` - common code shared by multiple `@data-driven-forms/*` packages
4+
5+
This package exists to share code used by more than one data-driven-forms package, such as:
6+
7+
* shared interfaces - propTypes
8+
* common mapper code - `condition` implementation
9+
10+
11+
## Usage
12+
13+
```
14+
const common = require('@data-driven-forms/common');
15+
16+
// shared props
17+
function MyComponent() {...}
18+
19+
MyComponent.propTypes = {
20+
...common.children.propTypes,
21+
isMulti: PropTypes.bool.isRequired,
22+
};
23+
24+
MyComponent.defaultProps = {
25+
...common.children.defaultProps,
26+
};
27+
28+
// condition code
29+
common.condition.evaluate({
30+
when: "field",
31+
in: ["foo", "bar"],
32+
}, { field: "baz" }); // false
33+
```

0 commit comments

Comments
 (0)