I'm setting up a new application in React and I want it to be server side rendered. Unfortunately I'm not able to use Headers since it keeps throwing the error 'ReferenceError: Headers is not defined'.
I've already tried to add Headers by adding:
import fetch from 'node-fetch';
global.fetch = fetch
global.Headers = fetch.Headers;
This still throws the error though.
This is an example of how I'm currently implementing the headers:
const defaultOptions = {
method: METHOD,
headers: new Headers({
'Content-type': 'application/json',
'X-Request-ID': new Date().getTime().toString(),
}),
};
Does anyone know what I'm missing to make it build and start?