<commit_before>#API

In these API docs, a **higher-order component (HOC)** refers to a function that accepts a single React component and returns a new React component.

**withLinkState** helper is a function that return **higher-order component**:

```javascript
const defaultState = ['key1', 'key2', 'key3'];

const hoc = withLinkState(defaultState);
const EnhancedComponent = hoc(BaseComponent);

// Same as
const EnhancedComponent = withLinkState(defaultState)(BaseComponent);

//or
const defaultState = [{'key1': 'This is the key1'}, {'key2': 10}, {'key3': false}];

const hoc = withLinkState(defaultState);
const EnhancedComponent = hoc(BaseComponent);

// Same as
const EnhancedComponent = withLinkState(defaultState)(BaseComponent);
```

Also, another way to use it, it's as a **decorator**: 

```javascript
@withLinkState(['key1', 'key2', 'key3'])
class BaseComponent extends React.Component { ... }
```

## TOC

* [Higher-order component](#higher-order-component)<commit_msg>Update API.md<commit_after>#API

In these API docs, a **higher-order component (HOC)** refers to a function that accepts a single React component and returns a new React component.

**withLinkState** helper is a function that return **higher-order component**:

```javascript
//define initialState keys
const defaultState = ['key1', 'key2', 'key3'];

const hoc = withLinkState(defaultState);
const EnhancedComponent = hoc(BaseComponent);

// Same as
const EnhancedComponent = withLinkState(defaultState)(BaseComponent);

//or define initialState with key:value
const defaultState = [{'key1': 'This is the key1'}, {'key2': 10}, {'key3': false}];

const hoc = withLinkState(defaultState);
const EnhancedComponent = hoc(BaseComponent);

// Same as
const EnhancedComponent = withLinkState(defaultState)(BaseComponent);
```

Also, another way to use it, it's as a **decorator**: 

```javascript
//define initialState keys
@withLinkState(['key1', 'key2', 'key3'])
class BaseComponent extends React.Component { ... }

//or define initialState with key:value
@withLinkState([{'key1': 'This is the key1'}, {'key2': 10}, {'key3': false}])
class BaseComponent extends React.Component { ... }
```

## TOC

* [Higher-order component](#higher-order-component)
{'fraction_non_alphanumeric': 0.14484304932735426, 'fraction_numerical': 0.013452914798206279, 'mean_word_length': 5.864615384615385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2424425', 'n_tokens_mistral': 691, 'n_tokens_neox': 635, 'n_words': 218}