문제

How to update the title tag in the Head ?

enter image description here

Really don't want to mess around with the DOM updating with javascript!

도움이 되었습니까?

해결책

To update <title> tag in custom component:

import { Meta, Title } from 'location-to-head-component/lib/components/Head';

Then return:

return (
        <>
            <Title>you-title-here - {yourVar}</Title>
            //page content here
        </>
    );

OR:

useEffect(() => {
      document.title = 'you-title-here - '+yourVar;
   }, [title]);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top