Fresh đối với Preact cũng giống như Next.js đối với React. React với Preact cung cấp khả năng render (làm framework), còn Fresh hay Next xử lý những thứ còn lại (làm meta framework)

Fresh is a website framework designed to be used with Deno
Preact is essentially a reactive rendering library
Preact can be used seperately to Fresh
The relationship between Next.JS and React is the same as the relationship between Fresh and Preact

Preact is just a rendering library and only concerns itself with getting stuff on the screen as fast as possible. It doesn’t do routing or any of those other concerns an app typically needs. That’s where Fresh comes in. The export default from a route file tells Fresh’s file based router that this is a route that you want to use. Then when you go to a route, Fresh basically calls Preact’s render() function to render the HTML, so you don’t need to do that yourself when working in Fresh

For simple sites there isn’t reall much Preact specific stuff to learn other than that you can compose parts of the HTML by creating functions that return JSX like

function Foo() {
  return <p>Hello world</p>

export default function Page() {
  return <div>
    <Foo />

This concept alone gets you pretty far.

In my opinion there is no need to learn Preact before Fresh. That’s pointless. Build a site with Fresh and you’ll pick up enough Preact knowledge while doing that already

Nguồn:: Discord
Fresh dùng Preact cho UI

Framework Meta Framework
Preact Fresh
React Next.js, Remix, Gatsby…
Vue Nuxt
Svelte SvelteKit
Solid SolidStart
Nguồn:: unable to use preact context in fresh · Issue #983 · denoland/fresh · GitHub

React được sinh ra để làm việc với trạng thái

Cập nhật lần cuối : 20 tháng 4, 2024
Tạo : 4 tháng 1, 2024