> For the complete documentation index, see [llms.txt](https://skycom.gitbook.io/adsbook-tech-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skycom.gitbook.io/adsbook-tech-doc/frontend.md).

# Frontend

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

### 1.Install

#### npm

```
npm i
or
npm i --legacy-peer-deps
```

#### yarn

```
yarn
```

### 2.Start

```
npm start
or
yarn start
```

### 3.Build

```
npm run build or yarn build
```

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>

Your app is ready to be deployed.

### User Guide

You can find detailed instructions on using Create React App and many tips in [its documentation](https://facebook.github.io/create-react-app/).

### Merge commit

#### Status

* Bugfix
* Features
* Refactor
* Docs

#### Task name

\-- status/task\_name

Example: Feature/11-login-view

#### Functions

**1. useCancelToken**

a. Use cancelToken

```javascript
 const { newCancelToken } = useCancelToken();
 
 const fetchData = async ()=>{
     const result = await callApi(endpoint, params = {...params, cancelToken: newCancelToken()})
 }
 
 useEffect(()=>{
     fetchData();
 },[...dependencies, newCancelToken])
```

b. Convert cancelToken in params

```javascript
    const fetchDataApi = async <T>(endpoint,params) => {
  const { cancelToken, paramsNoneCancelToken } = convertCancelToken(params);

  const paramsURL = formatParamsUtil(keyFilter, paramsNoneCancelToken);
  try {
    const result = await APIConfig(baseUrl).get(endpoint, { params: paramsURL, cancelToken});
    return result
  } catch (error) {
    return error
  }
};
```
