Need help on how to load Calendar widget from MaterialUI #1109
-
Hello, Trying with below code from fastapi import FastAPI
import uvicorn
from reactpy import component, html, run, web
from reactpy.backend.fastapi import configure
mui = web.module_from_template(
"react",
"@mui/x-date-pickers",
"@mui/material",
fallback="please wait loading..."
)
#Create calendar with material ui
DatePicker = web.export(mui,"DatePicker")
def Mycalender():
return html.div(
DatePicker ({
"label":"Basic date picker",
},"my calender"),
)
app = FastAPI()
configure(app,Mycalender)
if __name__ == '__main__':
uvicorn.run(app, port=8080, host='0.0.0.0') Getting below error on browser Also tried removing importing of "@mui/material"
but still no luck and got below error
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Unfortunately I don't think ReactPy is able to support
These are some of the reasons why we want to deprecate |
Beta Was this translation helpful? Give feedback.
Unfortunately I don't think ReactPy is able to support
DatePicker
viamodule_from_template
- there are two reasons for this:LocalizationProvider
and ReactPy has limited support for nesting JS componentsLocalizationProvider
requires a JSdateAdapter
and all props to JS component must be JSON serializable. So even if we could allow the JS components to be nested this would be a blocker.These are some of the reasons why we want to deprecate
module_from_template
- its uses are pretty limited.