Preact is a fast 3kB alternative to React with the same modern API.
This example uses shows how to use Material UI 4 with Preact X and Preact CLI 3.
git clone blah preact-mui| .evaluateTypeof() | |
| .evaluate() | |
| .evaluateIdentifier() | |
| .evaluateDefinedIdentifier() | |
| .evaluateCallExpressionMember() | |
| .statement(statement) | |
| .statementIf(statement) | |
| .label() | |
| .import(statement,source) | |
| .importSpecifier(statement,source,exportName,identifierName) |
Preact is a fast 3kB alternative to React with the same modern API.
This example uses shows how to use Material UI 4 with Preact X and Preact CLI 3.
git clone blah preact-mui| const express = require('express'); | |
| const { html, Component } = require('htm/preact'); | |
| const renderToString = require('preact-render-to-string'); | |
| class App extends Component { | |
| render(props) { | |
| return html` | |
| <div class="app"> | |
| <h1>This is an app</h1> | |
| <p>Current server time: ${new Date + ''}</p> |
| const express = require('express'); | |
| const htm = require('htm'); | |
| const vhtml = require('vhtml'); | |
| // create an html`` tag function for vhtml: | |
| const html = htm.bind(vhtml); | |
| const App = (props) => html` | |
| <div class="app"> | |
| <h1>This is an app</h1> |
| /** | |
| * Markdown Component | |
| */ | |
| const Markdown = React.memo(({ children, length, allowImages, renderAsPlaintext, linkifyHeadings }) => { | |
| let rendered = md({ allowImages, linkifyHeadings }).render(children || ''); | |
| let className = styles.markdownContent; | |
| if (length > 0) { | |
| rendered = truncate(rendered, length, { ellipsis: '…' }); |
Combines all bare imports (npm module imports) into a single packd-es import.
Input:
import { h, render } from 'preact@next';
import { useState } from 'preact@next/hooks';
import { html } from 'htm/preact';
render(h(() => html`<a />`), document.body);