Skip to content

Commit

Permalink
Update components-as-selectors.mdx (#938)
Browse files Browse the repository at this point in the history
Improve code format.
  • Loading branch information
mrdulin authored Oct 14, 2023
1 parent ebe1729 commit 3924af8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sections/advanced/components-as-selectors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ it rarely is easy without rigging up a well-known targeting CSS selector paradig
and then making them accessible for use in interpolations.

styled-components solves this use case cleanly via the "component selector" pattern. Whenever
a component is created or wrapped by the styled() factory function, it is also assigned a
a component is created or wrapped by the `styled()` factory function, it is also assigned a
stable CSS class for use in targeting. This allows for extremely powerful composition patterns
without having to fuss around with naming and avoiding selector collisions.

Expand Down Expand Up @@ -61,7 +61,7 @@ consider both sets of rules to understand why Icon behaves as it does.

This behaviour is only supported within the context of _Styled_ Components:
attempting to mount `B` in the following example will fail because component
`A` is an instance of React.Component not a Styled Component.
`A` is an instance of `React.Component` not a Styled Component.

```tsx
class A extends React.Component {
Expand All @@ -79,7 +79,7 @@ const B = styled.div`
The error thrown - `Cannot call a class as a function` - occurs because the
styled component is attempting to call the component as an interpolation function.

However, wrapping `A` in a styled() factory makes it eligible for interpolation -- just
However, wrapping `A` in a `styled()` factory makes it eligible for interpolation -- just
make sure the wrapped component passes along `className`.

```tsx
Expand Down

0 comments on commit 3924af8

Please sign in to comment.