Ruby on rails 使用React路由器重定向以设计视图

Ruby on rails 使用React路由器重定向以设计视图,ruby-on-rails,reactjs,react-router,devise,erb,Ruby On Rails,Reactjs,React Router,Devise,Erb,我目前正在RubyonRails应用程序中使用Desive进行身份验证,并在前端使用react。我希望在服务器端保留用于身份验证的designe视图,然后将当前用户传递给前端 我正在使用React路由器,在我的主页中,我试图在单击登录时重定向到/users/sign_-in,但是,尽管url更改为localhost:3000/users/sign_-in,但在我硬重新加载之前,不会呈现任何内容 你知道会发生什么吗 这是前端的代码 /** @jsx jsx */ import { jsx, css

我目前正在RubyonRails应用程序中使用Desive进行身份验证,并在前端使用react。我希望在服务器端保留用于身份验证的designe视图,然后将当前用户传递给前端

我正在使用React路由器,在我的主页中,我试图在单击登录时重定向到/users/sign_-in,但是,尽管url更改为localhost:3000/users/sign_-in,但在我硬重新加载之前,不会呈现任何内容

你知道会发生什么吗

这是前端的代码

/** @jsx jsx */
import { jsx, css } from "@emotion/react"
import light_logo from "../../../assets/images/medium-full.png"
import { NavLink } from "react-router-dom"

const HomeBar = () => {
  return (
    <div className="bar" css={BarStyles}>
      <div className="logo">
        <img src={light_logo} alt="logo" />
      </div>
      <div className="actions">
        <h4>Support</h4>
        <NavLink activeClassName="active" exact to="/users/sign_in">
          <h4>Log In</h4>
        </NavLink>
      </div>
    </div>
  )
}
视图显示正确,但仅在手动重新加载页面时显示

谢谢你的帮助

document.addEventListener("DOMContentLoaded", () => {
  ReactDOM.render(
    <BrowserRouter>
      <RecoilRoot>
        <div css={GlobalStyles}>
          <App />
        </div>
      </RecoilRoot>
    </BrowserRouter>,
    document.body.appendChild(document.createElement("div"))
  )
})
Rails.application.routes.draw do
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
  devise_for :users
  root to: "api/dashboard#home"

  namespace :api, defaults: { format: :json } do
    resources :dashboards
    resources :cookbooks
    resources :ingredients
    resources :recipes
  end


end