I am passing a state from Link element to another component, it works fine if I click on it, but if I try to open the link in a new tab, the state doesn't get passed. How can I fix this?
Code for reference:
<Link to={{pathname:"/open-page", state:{key: 'hello'}}}/>
openPage.js
import React, { useEffect, useRef } from 'react';
import { bool } from 'prop-types';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { createWidget } from '@typeform/embed';
import { injectIntl, intlShape } from '../../util/reactIntl';
export const OpenPageComponent = props => {
const { intl, scrollingDisabled } = props;
console.log('state', props.location.state.key); //undefined on opening in a new tab