question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Material UI / Preact compatible component library

See original GitHub issue

Hi,

I was trying to include Material UI since it is compatible with preact: https://twitter.com/preactjs/status/1152267975078154240?lang=en-GB

And including MUI core as a dependency as in normal deno: https://github.com/denoland/deno/issues/7282

However I run into [object Object] is not a valid HTML tag name: https://github.com/denoland/deno/issues/7282 when doing it both as a route and as an island.

Would in general all the packages in https://preactjs.com/about/libraries-addons/ technically be usable with Fresh ?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
gbahamondezccommented, Dec 10, 2022

@marsidev I had the same issue, updating the preact deps version in the @mui/material import line to the same than fresh is using 10.11.0 fixed the issue for me, example.

{
  "imports": {
    "$fresh/": "https://deno.land/x/fresh@1.1.2/",
    "preact": "https://esm.sh/preact@10.11.0",
    "preact/": "https://esm.sh/preact@10.11.0/",
    "preact-render-to-string": "https://esm.sh/*preact-render-to-string@5.2.4",
    "@preact/signals": "https://esm.sh/*@preact/signals@1.0.3",
    "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.0.1",
    "twind": "https://esm.sh/twind@0.16.17",
    "twind/": "https://esm.sh/twind@0.16.17/",
    "@mui/material": "https://esm.sh/@mui/material@^5.10.17?alias=react:preact/compat,react/jsx-runtime:preact/compat/jsx-runtime&deps=preact@10.11.0"
  }
}
1reaction
SalvadorLekancommented, Jul 7, 2022

I got it to work by adding this to the import_map.json. (I tested with this example from MUI’s Website and I got an alert in the browser) "@mui/material": "https://esm.sh/@mui/material@5.8.7?alias=react:preact/compat,react/jsx-runtime:preact/compat/jsx-runtime&deps=preact@10.8.1"

Read more comments on GitHub >

github_iconTop Results From Across the Web

preact-material-components
preact -material-components is a thin opinionless wrapper around material-components-web. Use these components to add material components to your web app, ...
Read more >
Material-UI 1.2.1 not working with Preact #476 - GitHub
Hi, Just create a default template preact-cli project, add material-ui and just use Button at https://material-ui.com/getting-started/usage/ An error is ...
Read more >
10 Top Preact Libraries and Tools for 2020 - Bits and Pieces
React class components and Function UI components work well with ClearX. You can simply install ClearX with the following NPM command: Follow ...
Read more >
Comparison with other libraries - Material-UI
Material -UI · Material Design Lite (MDL) · Material Components Web (MDC-web) · Materialize · React Toolbox ...
Read more >
Headless components in React and why I stopped using a UI ...
There are great React UI libraries out there, but I often find them too opinionated, hard to customize and quite big in size....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found