简体   繁体   English

如何从 React 组件内部使用 JavaScript 路由到 static html 页面?

[英]How does one route to a static html page with JavaScript from inside a React Component?

I saw solutions on StackOverFlow: like using the tag, and "browserHistory" but nothing I've tried so far has worked.我在 StackOverFlow 上看到了解决方案:比如使用标签和“browserHistory”,但到目前为止我所尝试的都没有奏效。

I'm attempting to route from inside a react-three-fiber component I built called "Animation.js".我正在尝试从我构建的名为“Animation.js”的 react-three-fiber 组件内部进行路由。 I only want to use React for the landing page, and then have the whole site in html, css and vanilla js as soon as my animation is done.我只想将 React 用于登录页面,然后在我的 animation 完成后立即将整个站点放在 html、css 和 vanilla js 中。

Inside my Animation.js file I want to just reroute to the vanilla main site:在我的 Animation.js 文件中,我只想重新路由到 vanilla 主站点: 在此处输入图像描述

This is what my project structure looks like:这是我的项目结构的样子: 项目结构

Note: I am using React function components and not classes.注意:我使用的是 React function 组件而不是类。

Happy to answer any questions to get to the bottom of this.很高兴回答任何问题以深入了解这一点。 Thanks so much!非常感谢!

I saw solutions on StackOverFlow: like using the tag, and "browserHistory" but nothing I've tried so far has worked.我在 StackOverFlow 上看到了解决方案:比如使用标签和“browserHistory”,但到目前为止我所尝试的都没有奏效。

I'm attempting to route from inside a react-three-fiber component I built called "Animation.js".我正在尝试从我构建的名为“Animation.js”的 react-three-fiber 组件内部进行路由。 I only want to use React for the landing page, and then have the whole site in html, css and vanilla js as soon as my animation is done.我只想将 React 用于登录页面,然后在我的 animation 完成后立即将整个站点放在 html、css 和 vanilla js 中。

Inside my Animation.js file I want to just reroute to the vanilla main site:在我的 Animation.js 文件中,我只想重新路由到 vanilla 主站点: 在此处输入图像描述

This is what my project structure looks like:这是我的项目结构的样子: 项目结构

Note: I am using React function components and not classes.注意:我使用的是 React function 组件而不是类。

Happy to answer any questions to get to the bottom of this.很高兴回答任何问题以深入了解这一点。 Thanks so much!非常感谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM