mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add router level support for rendering react componenent pages
This commit is contained in:
parent
4aa203c0c6
commit
eb605615d1
6 changed files with 34 additions and 3 deletions
13
src/components/reactControllerFactory.js
Normal file
13
src/components/reactControllerFactory.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
// TODO: Probably need to rehydrate on view restores
|
||||
|
||||
export default (view, params, { detail }) => {
|
||||
if (detail.options?.pageComponent) {
|
||||
import(/* webpackChunkName: "[request]" */ `./pages/${detail.options.pageComponent}`)
|
||||
.then(({ default: component }) => {
|
||||
ReactDOM.render(React.createElement(component), view);
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue