Skip to content

Commit de324dc

Browse files
Merge pull request #584 from preactjs/iso-imports
Switch from subpackage to main imports for `preact-iso`
2 parents f00974a + 579b7b6 commit de324dc

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Make a lazily-loaded version of a Component.
1313

1414
```js
1515
import { render } from 'preact';
16-
import lazy, { ErrorBoundary } from 'preact-iso/lazy';
17-
import { Router } from 'preact-iso/router';
16+
import { ErrorBoundary, lazy, Router } from 'preact-iso';
1817

1918
// Synchronous, not code-splitted:
2019
// import Home from './routes/home.js';
@@ -43,8 +42,7 @@ render(<App />, document.body);
4342
The Promise returned from `prerender()` resolves to an Object with `html` and `links[]` properties. The `html` property contains your pre-rendered static HTML markup, and `links` is an Array of any non-external URL strings found in links on the generated page.
4443

4544
```js
46-
import lazy, { ErrorBoundary } from 'preact-iso/lazy';
47-
import prerender from 'preact-iso/prerender';
45+
import { ErrorBoundary, lazy, prerender } from 'preact-iso';
4846

4947
// Asynchronous (throws a promise)
5048
const Foo = lazy(() => import('./foo.js'));
@@ -63,7 +61,7 @@ const { html, links } = await prerender(<App />, { maxDepth: 10 });
6361
`hydrate()` is a thin wrapper around Preact's hydrate() method. It performs hydration when the HTML for the current page includes pre-rendered output from `prerender()`. It falls back to plain rendering in any other cases, which is useful if you're not pre-rendering during development. This method also checks to make sure its running in a browser context before attempting any rendering - if not, it does nothing.
6462

6563
```js
66-
import hydrate from 'preact-iso/hydrate';
64+
import { hydrate } from 'preact-iso';
6765

6866
const App = () => (
6967
<div class="app">
@@ -79,8 +77,7 @@ hydrate(<App />);
7977
A simple router for Preact with conventional and hooks-based APIs. The `<Router>` component is async-aware: when transitioning from one route to another, if the incoming route suspends (throws a Promise), the outgoing route is preserved until the new one becomes ready.
8078

8179
```js
82-
import lazy, { ErrorBoundary } from 'preact-iso/lazy';
83-
import { LocationProvider, Router, useLocation } from 'preact-iso/router';
80+
import { ErrorBoundary, lazy, LocationProvider, Router, useLocation } from 'preact-iso';
8481

8582
// Asynchronous (throws a promise)
8683
const Home = lazy(() => import('./routes/home.js'));

0 commit comments

Comments
 (0)