mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 20:52:00 +08:00
website: make React not re-render Carbon
This commit is contained in:
@ -12,6 +12,19 @@ import styles from './styles.module.css';
|
|||||||
import {ThemeClassNames, useWindowSize} from '@docusaurus/theme-common';
|
import {ThemeClassNames, useWindowSize} from '@docusaurus/theme-common';
|
||||||
import SidebarAd from '../../components/SidebarAd';
|
import SidebarAd from '../../components/SidebarAd';
|
||||||
|
|
||||||
|
const CarbonAd = React.memo(() => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<script
|
||||||
|
async
|
||||||
|
type="text/javascript"
|
||||||
|
src="//cdn.carbonads.com/carbon.js?serve=CEAI4537&placement=wwwtechinterviewhandbookorg"
|
||||||
|
id="_carbonads_js"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
export default function DocItem(props) {
|
export default function DocItem(props) {
|
||||||
const {content: DocContent} = props;
|
const {content: DocContent} = props;
|
||||||
const {metadata, frontMatter} = DocContent;
|
const {metadata, frontMatter} = DocContent;
|
||||||
@ -80,12 +93,7 @@ export default function DocItem(props) {
|
|||||||
)}
|
)}
|
||||||
<DocItemFooter {...props} />
|
<DocItemFooter {...props} />
|
||||||
<div className="margin-top--md">
|
<div className="margin-top--md">
|
||||||
<script
|
<CarbonAd />
|
||||||
async
|
|
||||||
type="text/javascript"
|
|
||||||
src="//cdn.carbonads.com/carbon.js?serve=CEAI4537&placement=wwwtechinterviewhandbookorg"
|
|
||||||
id="_carbonads_js"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="margin-top--md">
|
<div className="margin-top--md">
|
||||||
<DocContent />
|
<DocContent />
|
||||||
|
Reference in New Issue
Block a user