File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
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
+ ```
You can’t perform that action at this time.
0 commit comments