[英]How can i export as multiple words in reactJS?
我有以下代碼:
import * as apple from './Apple.json';
import * as orange from "./Orange.json";
import * as pear from "./Pear.json";
export default {
Apple,
Orange,
Pear
}
我正在使用“導出默認值”中的條目在新頁面上創建超鏈接,但是,我想為每行導出 2 個單詞。
export default {
Blue Apple,
Red Orange,
Black Pear
}
問題是,這會破壞我的應用程序並且項目無法啟動。 我試圖添加“”,例如。 “藍蘋果”。 但這行不通。
我怎樣才能做到這一點?
這樣的事情會解決您的問題嗎?
export default {
'Blue Apple': 'Blue Apple',
'Red Orange': 'Red Orange',
'Black Pear': 'Black Pear'
}
或者只是導出字符串值的數組
export default ['Blue Apple', 'Red Orange', 'Black Pear']
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.