chore: version preact explicitly in import map (#258)
This allows users to control the `preact` version independently of fresh itself.
This commit is contained in:
@@ -31,7 +31,8 @@ Here is an example of an island component that counts down to a specific time.
|
||||
// islands/Countdown.tsx
|
||||
|
||||
/** @jsx h */
|
||||
import { h, useEffect, useState } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
|
||||
const timeFmt = new Intl.RelativeTimeFormat("en-US");
|
||||
|
||||
@@ -73,7 +74,7 @@ client with the correct props:
|
||||
// routes/countdown.tsx
|
||||
|
||||
/** @jsx h */
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import Countdown from "../islands/Countdown.tsx";
|
||||
|
||||
export default function Page() {
|
||||
|
||||
@@ -38,7 +38,7 @@ This is done with JSX.
|
||||
// routes/about.tsx
|
||||
|
||||
/** @jsx h */
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
|
||||
export default function AboutPage() {
|
||||
return (
|
||||
|
||||
@@ -31,7 +31,7 @@ then adds a custom header to the response before returning it:
|
||||
// routes/about.tsx
|
||||
|
||||
/** @jsx h */
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
|
||||
@@ -28,7 +28,8 @@ as arguments in it's `props` object though.
|
||||
// routes/greet/[name].tsx
|
||||
|
||||
/** @jsx h */
|
||||
import { h, PageProps } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { PageProps } from "$fresh/runtime.ts";
|
||||
|
||||
export default function GreetPage(props: PageProps) {
|
||||
const { name } = props.params;
|
||||
|
||||
@@ -24,7 +24,8 @@ renders it in a page component.
|
||||
// routes/github/[username].tsx
|
||||
|
||||
/** @jsx h */
|
||||
import { h, PageProps } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { PageProps } from "$fresh/runtime.ts";
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
interface User {
|
||||
|
||||
@@ -33,7 +33,8 @@ server side:
|
||||
// routes/search.tsx
|
||||
|
||||
/** @jsx h */
|
||||
import { h, PageProps } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { PageProps } from "$fresh/runtime.ts";
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
const NAMES = ["Alice", "Bob", "Charlie", "Dave", "Eve", "Frank"];
|
||||
|
||||
Reference in New Issue
Block a user