You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often when creating similar components or components that have a parent-child relationship, it is useful to namespace your components. Types can easily be added be using `Object.assign()`;
1141
1141
1142
1142
```tsx
1143
-
importReactfrom'react'
1143
+
importReactfrom"react";
1144
1144
1145
-
constInput= (props:any) => <input {...props} />
1145
+
constInput= (props:any) => <input {...props} />;
1146
1146
1147
-
const Form = React.forwardRef<HTMLDivElement, any>(({children, ...otherProps}, ref) => (
1148
-
<form {...otherProps} ref={ref}>
1149
-
{children}
1150
-
</form>
1151
-
));
1147
+
constForm=React.forwardRef<HTMLDivElement, any>(
1148
+
({ children, ...otherProps }, ref) => (
1149
+
<form {...otherProps} ref={ref}>
1150
+
{children}
1151
+
</form>
1152
+
)
1153
+
);
1152
1154
1153
1155
/**
1154
1156
* Exported components now can be used as `<Form>` and `<Form.Input>`
1155
1157
*/
1156
-
exportdefaultObject.assign(Form, {Input: Input});
1158
+
exportdefaultObject.assign(Form, {Input: Input});
1157
1159
```
1158
1160
1159
1161
[View in the TypeScript Playground](https://www.typescriptlang.org/play/?jsx=2&ssl=1&ssc=1&pln=14&pc=52#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wFgAoCtCAOwGd4BJGsAV3gF44AKMHMOgC44KGgE8AlHA4A+OAB5gLdnADeAOk18IAgL5wA9DIpVaDOADFoeLsnQx1maAHcUUACbJM8gBIAVAFkAGQARYAA3AFEAGyQQJBoYABoRcRlublU0AAtgaPciGhTNdQgYbKQoAAV+Ol0UokwpWR4KOAUnKDwNTTKK6tr9Ro5VRt1jcnb2rNz8wt02hQNOkAmJCQBuE3IDACpdtt24SIAPSFgkdzhqcFoEmDo4Gghna9E4ACMkOFY6S5FHgADeRWLoyQGpK7A0EgdTMNgwcGHAwUJBnaDwdxITAoVjReAAeQ+ACskBh1Cg6HRgABzGjcGEpVTw9jCFkwXSbIA)
0 commit comments