Registry / web-framework / what-framework

what-framework

JSON →
library0.8.1jsnpmunverified

What Framework is a JavaScript framework designed to be as close to vanilla JS as possible, leveraging a signals-based reactivity system and a compiler-first JSX approach, rather than a virtual DOM, to achieve fine-grained updates and high performance. It features an islands architecture for efficient server-side rendering (SSR) and re-exports core functionalities from `what-core`. The current stable version is 0.8.1, with recent updates (v0.7.0) focusing heavily on performance enhancements across signal reading, computed properties, effects, and DOM rendering. Key differentiators include its no-VDOM approach, native TypeScript support, and a comprehensive ecosystem offering React-familiar hooks (useState, useEffect), built-in data fetching (SWR/TanStack Query style), robust form handling, animation primitives, and a dedicated router.

npm install what-framework
INSTALL
IMPORT
SIG · WHAT-FRAMEWORK
W
what-framework
web-frameworkjavascriptv0.8.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mount, useSignal
import { mount, useSignal } from 'what-framework';
const { mount, useSignal } = require('what-framework');
What Framework is an ESM-first library; CommonJS `require()` is not supported for its main entry point and may lead to module resolution errors.
signal, computed, effect
import { signal, computed, effect } from 'what-framework';
import signal from 'what-framework/signal';
Core reactivity primitives like `signal`, `computed`, and `effect` are named exports from the main `what-framework` package. Avoid attempting to import them from sub-paths or as default exports.
useState, useEffect
import { useState, useEffect } from 'what-framework';
import * as Hooks from 'what-framework';
React-familiar hooks such as `useState` and `useEffect` are provided as named exports from the main package, consistent with their usage in React itself.
createServer, renderToString
import { createServer, renderToString } from 'what-framework/server';
import { createServer } from 'what-framework';
Server-side rendering (SSR) utilities are exposed via a dedicated sub-path export: `what-framework/server`. Importing them directly from the main package will not work.

Demonstrates creating a reactive counter component using `useSignal` and mounting it to a DOM element (with a robust fallback if '#app' is not found).

import { mount, useSignal } from 'what-framework'; function Counter() { const count = useSignal(0); return ( <div> <p>Count: {count()}</p> <button onClick={() => count.set(c => c + 1)}>+</button> </div> ); } mount(<Counter />, document.querySelector('#app') ?? document.body);
Debug
Known issues
breakingWhat Framework utilizes a compiler-first JSX approach, requiring a specific build-time transformation plugin (e.g., `what-compiler/vite` for Vite) to correctly convert JSX syntax into framework-specific render calls. Failure to configure this will result in JSX compilation errors or unexpected runtime behavior.
fix
For Vite users, ensure `what-compiler/vite` is installed as a dev dependency and configured in your `vite.config.js` under the `plugins` array (e.g., `plugins: [what()]`).
affects: >=0.1.0
gotchaWhile What Framework offers a 'React Compat' layer designed to enable the use of many React libraries, it does not guarantee 100% compatibility. Complex React patterns or libraries deeply tied to React's internal reconciliation process might not function as expected or might require specific shims.
fix
Thoroughly test React libraries when integrating them with What Framework. Consult the official 'React Compat' documentation for known limitations, compatibility guides, and potential workarounds.
affects: >=0.1.0
gotchaWhat Framework's signals are designed for fine-grained reactivity. Directly mutating a signal's underlying value (e.g., altering an array or object held by a signal without using its `set()` method) will bypass the reactivity system, leading to components not re-rendering or state inconsistencies.
fix
Always use the signal's provided `set(newValue)` or `set(updaterFn)` method to update its value, ensuring the reactivity system correctly tracks changes and triggers updates.
affects: >=0.1.0
gotchaVersion 0.7.0 introduced significant internal performance optimizations across signal reading, computed properties, effects, and DOM rendering. While public APIs were generally kept stable, users relying on very specific internal timings or subtle behaviors in older versions might observe minor differences in edge cases due to the refactored core mechanisms.
fix
Review applications for any highly performance-sensitive paths or edge cases that might have inadvertently relied on pre-0.7.0 internal behavior. Conduct thorough regression testing after upgrading to ensure consistent behavior.
affects: >=0.7.0
Errors
Common errors & fixes
ReferenceError: React is not defined
This error typically occurs when JSX syntax is used without a configured build-time transformation plugin, as What Framework's JSX compilation does not rely on a global `React` object.
fix
Ensure you have the correct compiler plugin installed and configured for your build tool (e.g., `what-compiler/vite` for Vite) to correctly transform JSX into What Framework's internal rendering calls.
Error: Hooks can only be called inside component functions.
A hook (e.g., `useState`, `useEffect`, `useSignal`) is being invoked outside the execution context of a What Framework component function (e.g., in a global scope, a plain utility function, or a non-component class method).
fix
Refactor your code to ensure all hook calls are made directly within the body of a What Framework component function, adhering to the rules of hooks.
Module not found: Can't resolve 'what-framework/server' in '...'
This usually indicates an attempt to import from a sub-path export that either doesn't exist, is misspelled, or your bundler isn't correctly resolving package `exports` fields.
fix
Verify that the sub-path export `what-framework/server` is correctly spelled. Ensure your build tool (e.g., Webpack, Vite, Node.js) supports and correctly configures package `exports` maps for module resolution.
TypeError: Cannot read properties of undefined (reading 'set')
This error often occurs when attempting to call the `.set()` method on a signal that is `undefined` or `null` at the point of invocation, typically due to improper initialization, conditional rendering, or asynchronous timing.
fix
Ensure your signal variables are always initialized with `useSignal()` or `signal()` and are accessible when you attempt to call `.set()`. Debug the component lifecycle to confirm the signal instance exists at the time of the update.
Upgrade
Version history
0.8.1latest on npm
Audit
Dependencies
what-corerequiredProvides the foundational signals-based reactivity core, which `what-framework` builds upon and re-exports.
what-compiler/viteoptionalRequired for JSX transformation when using Vite as the build tool.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources