我正在React.js中处理单个页面应用程序,那么在页面转换或浏览器后退/前进时更新元标记的最佳方法是什么?
我在一个较旧的项目中使用了react-document-meta。
只需定义您的元值
const meta = {
title: 'Some Meta Title',
description: 'I am a description, and I can create multiple tags',
canonical: 'http://example.com/path/to/page',
meta: {
charset: 'utf-8',
name: {
keywords: 'react,meta,document,html,tags'
}
}
并放置一个
<DocumentMeta {...meta} />
在回报
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句