# styled component

{% embed url="<https://styled-components.com/>" %}

類似於把 style 抽出放在一個 higher order component的概念，但是寫在同一個檔案。

```javascript
import styled from 'styled-components';

const StyledTable = styled.table`
  width: calc(100% - 64px);
  margin: 32px;
  border: 1px solid black;
  background-color: gray;
  thead {
    font-weight: bold;
  }
`

const Table = () => {
  <StyledTable>
    <thead>
      <tr>
  .....
  </StyledTable>
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://easonwang.gitbook.io/web_advance/react/styled-component.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
