過去幾天我一直在學習ReactJS,並一直試圖在ReactJS中使用semantic-ui-react
構建網站。我知道現在可以使用的組件,但我堅持在創建頁腳等場景中做什麼......通常,在我的原始HTML中,我將包含semantic.min.css
文件並位於底部:Semantic-UI-React Footer
<div class="ui inverted pink vertical footer segment">
<div class="ui center aligned container">
<h4 class="ui inverted header">© Copyright 2017 | All rights reserved | Blahhh</h4>
<a href="https://www.facebook.com/"><i class="facebook square icon big"></i></a>
<a href="https://twitter.com/"><i class="twitter square icon big"></i></a>
<a href="https://www.linkedin.com/company/c"><i class="linkedin square icon big"></i></a>
</div>
</div>
現在我想把它翻譯成semantic-ui-react
。頁腳是一個類,不是默認情況下的一個組件,所以沒有它的組件...我認爲這意味着我必須創建自己的組件,並基本編寫上面的代碼。我現在的問題是,我不知道如何使它呈現,就好像我使用普通的舊的semantic.min.css一樣。我讀了一個地方下載css文件幷包含它,但其中一個,我不知道在哪裏(MyCustomFooterComponent
或index.html
),這樣做,我的網站上的加載時間不會增加。這是否意味着在任何地方都有一個頁腳,只是一小段自定義代碼,整個CSS文件將被加載?
另外,建立後,我會添加Semantic CSS和semantic-ui-react
的CSS,是否會出現雙重導入場景?
對不起長期的問題,但我是新來的,我想在發現一個可怕的錯誤之前找出我能做的。
感謝您的快速回復。但是,我在我的'MyCustomFooterComponent.js'文件中導入了什麼呢?它如何知道引用它?因爲對於所有其他語義組件,語法從'semantic-ui-react''導入{Button}以使用按鈕等... – niiapa
如果您正在使用'create-react-app',那麼在您的'MyCustomFooterComponent'你導出該組件 'export default MyCustomFooterComponent;' 然後你可以從別的地方導入從'。/ MyCustomFooterComponent.js''導入MyCustomFooterComponent –
我想我誤解了該怎麼做。包括'semantic-ui-react'不會自動包含CSS。我必須手動包含它,然後classNames會工作?這不是雙重包容?首先從'semantic-ui-react'然後從'semantic-ui-css'? – niiapa