Skip to content

Commit 840f317

Browse files
committed
Prettify ADVANCED.md
1 parent 6f5f0c7 commit 840f317

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ADVANCED.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,20 +1140,22 @@ export default function MyComponent({ label = "foobar" }: MyProps) {
11401140
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()`;
11411141
11421142
```tsx
1143-
import React from 'react'
1143+
import React from "react";
11441144

1145-
const Input = (props: any) => <input {...props} />
1145+
const Input = (props: any) => <input {...props} />;
11461146

1147-
const Form = React.forwardRef<HTMLDivElement, any>(({children, ...otherProps}, ref) => (
1148-
<form {...otherProps} ref={ref}>
1149-
{children}
1150-
</form>
1151-
));
1147+
const Form = React.forwardRef<HTMLDivElement, any>(
1148+
({ children, ...otherProps }, ref) => (
1149+
<form {...otherProps} ref={ref}>
1150+
{children}
1151+
</form>
1152+
)
1153+
);
11521154

11531155
/**
11541156
* Exported components now can be used as `<Form>` and `<Form.Input>`
11551157
*/
1156-
export default Object.assign(Form, {Input: Input});
1158+
export default Object.assign(Form, { Input: Input });
11571159
```
11581160
11591161
[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

Comments
 (0)