React list public files

Viewed 1187

I want to list all the file in the PUBLIC directory with React, do you have any idea how i can do that ?

(And please, don't tell me to use fs, i need it for react, not with Node.js)

1 Answers

I think you can do this using list-react-files

list-react-files https://www.npmjs.com/package/list-react-files

Install

$ npm install --save list-react-files

Usage

import listReactFiles from 'list-react-files'

listReactFiles(__dirname).then(files => console.log(files))
Related