Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: runtime config 增加 reduck 配置传输 #5541

Open
undermoodzyx opened this issue Mar 16, 2024 · 1 comment
Open

[Feature]: runtime config 增加 reduck 配置传输 #5541

undermoodzyx opened this issue Mar 16, 2024 · 1 comment

Comments

@undermoodzyx
Copy link

undermoodzyx commented Mar 16, 2024

这个功能解决了什么问题?

在约定式路由场景下,可以配置 reduck 的 middlewares

你期望的 API 是什么样子的?

其实更需要的是一个 api ,在约定式路由场景下,用户自行控制 App elem

// index.tsx
import Provider from 'project-specific'
import { AppReactElem } from '@modern-js/runtime'

export function render() {
  return (<Provider><AppReactElem /></Provider/>)
}
@guangzan
Copy link

约定式路由场景下,请问目前有什么解决方案吗,比如使用 NiceModal 需要添加根组件的 Provider:

import NiceModal from '@ebay/nice-modal-react';

ReactDOM.render(
  <React.StrictMode>
    <NiceModal.Provider>
      <App />
    </NiceModal.Provider>
  </React.StrictMode>,
  document.getElementById('root'),
);

类似的,使用 react router v6 的 <ScrollRestoration /> 时,需要添加到根路由中:

+ import { ScrollRestoration } from "react-router-dom";

function RootRouteComponent() {
  return (
    <div>
      {/* ... */}
+     <ScrollRestoration />
    </div>
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants