preact-compat #432
Replies: 3 comments 14 replies
-
https://esm.sh URLs support an e.g. https://esm.sh/zustand?alias=react:preact/compat&deps=react I'd still like to know what the best practice is. |
Beta Was this translation helpful? Give feedback.
-
That's a pretty neat idea, @rtwall, thanks! I finally figured out how to tell a dependency to use Preact instead of React, too! I wanted to import Statery ("surprise-free state management!") which internally uses React (excerpt from its import { useEffect, useRef, useState } from "react"`) So, in a React-based app I'd call it like this: import { makeStore, useStore } from "statery"; In Fresh, I instead use the esm.sh aliasing as described: import { makeStore, useStore } from "https://esm.sh/[email protected]?alias=react:preact/compat&[email protected]"; If I omit the So: aliasing works absolutely fine, and it's a good-enough practice until I'm told otherwise by people more knowledgeable than myself. :) I've learned something today, thanks. |
Beta Was this translation helpful? Give feedback.
-
completely agree, but right now a lot of tooling is not available to Fresh,
especially in the area of UI components, so these hacks are unfortunately
needed at least for now -> although I am looking at doing a fresh/preact
port of tailwind headless ui that does not rely on preact-compat
eventually. (though I do wish Mantine worked with Preact/Fresh... oh
well...)
…On Wed, Aug 3, 2022 at 8:00 PM Carlo Zottmann ***@***.***> wrote:
@scott-ling <https://github.com/scott-ling> I try to avoid overly
implicit code like this — I tend to forget about the hacks that make my
code work, and in a month I get confused. ;)
—
Reply to this email directly, view it on GitHub
<#432 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATXWUNUJJOAFSDML73SS753VXK6VHANCNFSM52XE47DQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
How to use deno fresh with
preact-compat
?I'm trying to add zustand to a fresh project.
Normally you'd alias react and react-dom as explained here: https://preactjs.com/guide/v10/switching-to-preact but I don't quite get how to set that up for a fresh project.
Beta Was this translation helpful? Give feedback.
All reactions