Итак, я в основном пытаюсь передать данные с одной страницы на другую через ссылку Гэтсби ...
Ответ, который я получаю, когда использую console.log с "this.props.location":
{pathname: "/visStudier/", search: "", hash: "", href: "http://localhost:8000/visStudier/", origin: "http://localhost:8000", …}
и состояние:
state: {query: "", key: "1588341353925"}
Это код ссылки, который я использую:
<Link to={`/nextPage`} state={{ searchQuery: true }} search={{tag:1}}> link-text
</Link>
Мой пакет. json:
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"axios": "^0.19.2",
"bootstrap": "^4.4.1",
"gatsby": "^2.19.49",
"gatsby-background-image": "^0.10.2",
"gatsby-image": "^2.2.39",
"gatsby-plugin-manifest": "^2.2.39",
"gatsby-plugin-offline": "^3.0.32",
"gatsby-plugin-react-helmet": "^3.1.21",
"gatsby-plugin-sass": "^2.1.29",
"gatsby-plugin-sharp": "^2.4.3",
"gatsby-remark-embed-video": "^2.0.1",
"gatsby-source-filesystem": "^2.1.46",
"gatsby-source-graphql": "^2.1.34",
"gatsby-source-pg": "^0.1.4",
"gatsby-source-strapi": "0.0.10",
"gatsby-transformer-remark": "^2.7.1",
"gatsby-transformer-sharp": "^2.3.13",
"graphql-hooks": "^4.4.3",
"js-search": "^2.0.0",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1",
"react-icons": "^3.9.0",
"react-markdown": "^4.3.1",
"react-moment": "^0.9.7",
"react-router": "^5.1.2",
"reactstrap": "^8.4.1"
},
"devDependencies": {
"file-loader": "^6.0.0",
"image-webpack-loader": "^6.0.0",
"prettier": "^1.19.1"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
Есть ли веская причина, по которой это должно быть сложно? Я просто пытаюсь передать поисковый запрос с одной страницы на другую.