我想将默认前缀更改为 Font Awesome Regular 所以尝试做
fontawesome.config = {
familyPrefix: "far"
};
但我仍然需要做一个“远”前缀才能使其工作
import React from "react";
import { render } from "react-dom";
import Hello from "./Hello";
import fontawesome from "@fortawesome/fontawesome";
import FontAwesomeIcon from "@fortawesome/react-fontawesome";
import faCalendar from "@fortawesome/fontawesome-free-regular/faCalendar";
import faSquare from "@fortawesome/fontawesome-free-regular/faSquare";
fontawesome.config = {
familyPrefix: "far"
};
fontawesome.library.add(faCalendar, faSquare);
const styles = {
fontFamily: "sans-serif",
textAlign: "center"
};
const App = () => (
<div style={styles}>
<Hello name="CodeSandbox" />
<h2>Start editing to see some magic happen {"\u2728"}</h2>
Favorite beverage: <FontAwesomeIcon icon="calendar" /> //does not work
Icon from regular: <FontAwesomeIcon icon={["far", "square"]} /> //works
</div>
);
render(<App />, document.getElementById("root"));