Conditional import or alternative in JavaScript (ReactJS WebApp)?

后端 未结 3 1196
猫巷女王i
猫巷女王i 2021-01-19 09:28

I\'m implementing internationalization for a ReactJS webapp. How can I avoid loading all language files?

import ru from \'./ru\';
import en from \'./en\';

         


        
3条回答
  •  野的像风
    2021-01-19 10:18

    Take a look at the react-loadable package - if you can somehow encapsulate your language files into components, this might solve your problem.

提交回复
热议问题