一种不错的方法(不添加伪造的.js扩展名,用于代码而不用于数据和配置)是使用
json-loader模块。如果您曾经使用
create-react-app过脚手架,那么该模块已经包含在内,您只需导入json:
import Profile from './components/profile';

一种不错的方法(不添加伪造的.js扩展名,用于代码而不用于数据和配置)是使用
json-loader模块。如果您曾经使用
create-react-app过脚手架,那么该模块已经包含在内,您只需导入json:
import Profile from './components/profile';