When developers use Frontity, the framework controls how the app is rendered (on both client and server).
This gives us the opportunity to render the whole
<html> element with react and not just the
<body> of the document.
Currently, Frontity is using
react-helmet to manage the
<head> of the document. This library comes with some extra bytes on top of the frontity framework (obviously) and it dynamically injects content into the
<head> of the document outside of the React lifecycle.
By creating our own
<Head> component we could save some bytes from the Frontity bundle and manage the injection of elements into the
<head> within pure react by leveraging React Context.
I have created a very simple demo of the concept: https://codesandbox.io/s/manage-document-head-with-pure-react-jz2hd