# react-fe

> ```tsx import React from 'react'; import FileExplorer from './react-file-explorer'; import FileExplorerApi, { BasicEntry, IEntryWithTypes } from './react-file-explorer/FileExplorerApi';

Latest version **1.2.0** (published 2022-06-22) · 0 weekly downloads

## Install

```sh
npm install react-fe
pnpm add react-fe
yarn add react-fe
bun add react-fe
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-06-22 |
| First published | 2022-06-03 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 57.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lucasion |

## Links

- npm: https://www.npmjs.com/package/react-fe
- npm.io page: https://npm.io/package/react-fe

## Dependencies (12)

- [react](https://npm.io/package/react.md) ^18.1.0
- [typescript](https://npm.io/package/typescript.md) ^4.4.2
- [@types/node](https://npm.io/package/@types/node.md) ^16.7.13
- [@types/react](https://npm.io/package/@types/react.md) ^18.0.0
- [@mantine/core](https://npm.io/package/@mantine/core.md) ^4.2.7
- [@mantine/form](https://npm.io/package/@mantine/form.md) ^4.2.7
- [@mantine/next](https://npm.io/package/@mantine/next.md) ^4.2.7
- [@mantine/hooks](https://npm.io/package/@mantine/hooks.md) ^4.2.7
- [@mantine/modals](https://npm.io/package/@mantine/modals.md) ^4.2.7
- [@mantine/dropzone](https://npm.io/package/@mantine/dropzone.md) ^4.2.7
- [tabler-icons-react](https://npm.io/package/tabler-icons-react.md) ^1.48.1
- [@mantine/notifications](https://npm.io/package/@mantine/notifications.md) ^4.2.7

## Recent versions

- 1.2.0 (latest) — 2022-06-22
- 1.1.2 — 2022-06-20
- 1.1.1 — 2022-06-20
- 1.1.0 — 2022-06-04
- 1.0.0 — 2022-06-03

## README

# Example of use
```tsx
import React from 'react';
import FileExplorer from './react-file-explorer';
import FileExplorerApi, { BasicEntry, IEntryWithTypes } from './react-file-explorer/FileExplorerApi';

// Custom API to display how the component works.
const baseUrl = "https://myserver.org";
const api: FileExplorerApi = {
  async getFiles (path: string) {
    const files: IEntryWithTypes[] = await fetch(`${baseUrl}${path}`).then(res => {
      if (res.status === 200) {
        return res.json();
      }
      else {
        throw new Error(`Failed to get files from ${path}`);
      }
    });
    return BasicEntry.buildBulk(files);
  },

  async rename(path: string, newName: string) {
    console.log(`Renaming ${path} to ${newName}`);

    return fetch(`${baseUrl}${path}`, {
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        action: "rename",
        newName,
      }),
    }).then(res => {
      if (res.status === 200) {
        return true;
      }
      else {
        throw new Error(`Failed to rename ${path} to ${newName}`);
      }
    });
  },

  async openFile(path: string) {
    window.open(baseUrl + path);
  },

  pathToDataUrl(path: string) {
    return baseUrl + path;
  }
};

function App() {
  return (
    <div className="App" style={{
      width: "100vw",
      height: "100vh",
    }}>
      <FileExplorer api={api} />
    </div>
  );
}

export default App;
```

---
_Source: https://npm.io/package/react-fe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
