head tag react code example
Example 1: i18n react meta description
import { useIntl } from 'react-intl';
const DescriptionMeta = () => {
const { formatMessage: f } = useIntl();
return (
<Helmet>
<meta name="description" content={f({ id: 'meta.description' })} />
</Helmet>
);
};
Example 2: change title react
import React from 'react'
import ReactDOM from 'react-dom'
class Doc extends React.Component{
componentDidMount(){
document.title = "dfsdfsdfsd"
}
render(){
return(
<b> test </b>
)
}
}
ReactDOM.render(
<Doc />,
document.getElementById('container')
);