# ftree4587

> This is a simple File tree react component for usage in projects like CodeSandbox or Replit and many others.

Latest version **0.2.1** (published 2021-11-15) · (MIT OR Apache-2.0) license · 0 weekly downloads

## Install

```sh
npm install ftree4587
pnpm add ftree4587
yarn add ftree4587
bun add ftree4587
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2021-11-15 |
| First published | 2021-08-12 |
| Weekly downloads | 0 |
| License | (MIT OR Apache-2.0) |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 3.2 MB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | T.O KOZA |
| Maintainers | thehackingknight |
| Keywords | react, react filetree, filetree, react-filetree, filetree component |

## Links

- npm: https://www.npmjs.com/package/ftree4587
- Repository: https://github.com/thehackingknight/react-filetree
- Homepage: https://github.com/thehackingknight/react-filetree#readme
- Issues: https://github.com/thehackingknight/react-filetree/issues
- npm.io page: https://npm.io/package/ftree4587

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [ftree4587](https://npm.io/package/ftree4587.md) ^0.1.1
- [packages-next](https://npm.io/package/packages-next.md) ^0.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2021-11-15
- 0.2.0 — 2021-11-15
- 0.1.9 — 2021-08-13
- 0.1.8 — 2021-08-13
- 0.1.7 — 2021-08-13
- 0.1.6 — 2021-08-13
- 0.1.5 — 2021-08-13
- 0.1.4 — 2021-08-13
- 0.1.3 — 2021-08-13
- 0.1.2 — 2021-08-12
- 0.1.1 — 2021-08-12
- 0.1.0 — 2021-08-12

## README

This is a simple File tree react component for usage in projects like CodeSandbox or Replit and many others.

## Getting Started

### Installation

```bash
npm i ftree4587
```
### Usage


![Component screenshot](https://res.cloudinary.com/sketchi/image/upload/v1636957782/ftree_yofhoy.png)



```javascript
import {useState} from 'react'
import FileTree from 'ftree4587'

const testFiles = 
[
      {
        "id": "cb05122d4c3347ce90bea515cca4c858",
        "name": "STYLES",
        "children": [
          {
            "id": "0caca625dc324a6cb8f319a51dc2ae0b",
            "name": "one.css",
            "language": "css",
            "content": ".one{}"
          },
          {
            "id": "87fb7d03745049459ff343eb07e8568e",
            "name": "two.css",
            "language": "css",
            "content": ".two{}"
          },
          {
            "name": "SUBSTYLES",
            "id": "fb7d03745049459ff343eb07e8568e",
            "children": [
              {
                "name": "substyle1.css",
                "id": "substyle1ID"
              },
              {
                "name": "substyle2.css",
                "id": "substyle2ID"
              }
            ]
          }
        ]
      },
      {
        "id": "2e094d54f8d040408df66af33f08b3c6",
        "name": "index.html",
        "language": "html",
        "content": "\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <link rel=\"stylesheet\" href=\"style.css\">\n  <title>My Virt</title>\n</head>\n<body>\n  \n  <script type=\"text/javascript\" src=\"script.js\"></script>\n</body>\n</html>\n         "
      },
      {
        "id": "1d46ebb14b034b449384d8244a3c1bc7",
        "name": "script.js",
        "language": "javascript",
        "content": ""
      },
      {
        "id": "3fe10c8a29df4723a6802ce26fa10a4e",
        "name": "style.css",
        "content": "body{\r\n    background-color: black;\r\n}",
        "language": "css"
      }
    ]


export default function Test(){

    const [files, setFiles] = useEffect(testFiles)

    const getCurrentFile = (file) =>{
        
        console.log(file) //Outputs the currently clickes/selected file
    }


    return <FileTree files={files} setFiles={setFiles} getCurrentFile={getCurrentFile}/>
}
```

### Props

| Name | Value | Description |
|--------------|--------------|--------------|
| files | Array| These the files to display. <br/>An array of json representative of files,<br/> each having a unique ID.|
| setFiles| function| When you update the files; either by renaming a file, </br>modifying a file's content, creating a new file <br/>or deleting a file; the new files will be recieved by this function.|
|getCurrentFile|function| This function will recieve the currently clicked or selected file<br/> and you can do whatever you want to do with the data, <br/>such as displaying the content of the file.

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