How i can import js file dynamic in React

Viewed 40

How i can import js file dynamic in React, That want i want to do

const [file, setFile] = useState('file1')
import component from `./folder/${file}`;

After a click event i want to change the name of js file.

0 Answers
Related