Gathering detailed insights and metrics for solid-js
Gathering detailed insights and metrics for solid-js
Gathering detailed insights and metrics for solid-js
Gathering detailed insights and metrics for solid-js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
npm install solid-js
Typescript
Module System
Node Version
NPM Version
99
Supply Chain
100
Quality
86.4
Maintenance
100
Vulnerability
100
License
v1.9.0 - LGTM!
Published on 24 Sept 2024
v1.8.0 - Bifröst
Published on 09 Oct 2023
v1.7.0 - U Can't Type This
Published on 30 Mar 2023
v1.6.0 - Castle in the Sky
Published on 20 Oct 2022
v1.5.0 - Batch to the Future
Published on 26 Aug 2022
v1.4.0 - Level Up!
Published on 12 May 2022
TypeScript (71.69%)
JavaScript (28.09%)
CSS (0.21%)
Total Downloads
21,733,791
Last Day
50,661
Last Week
291,006
Last Month
1,209,204
Last Year
14,055,814
32,591 Stars
1,805 Commits
936 Forks
213 Watching
6 Branches
170 Contributors
Minified
Minified + Gzipped
Latest Version
1.9.3
Package Id
solid-js@1.9.3
Unpacked Size
866.44 kB
Size
189.11 kB
File Count
77
NPM Version
9.8.1
Node Version
20.6.1
Publised On
22 Oct 2024
Cumulative downloads
Total Downloads
Last day
-4.3%
50,661
Compared to previous day
Last week
7.1%
291,006
Compared to previous week
Last month
18.1%
1,209,204
Compared to previous month
Last year
163.4%
14,055,814
Compared to previous year
3
Website • API Docs • Features Tutorial • Playground • Discord
Solid is a declarative JavaScript library for creating user interfaces. Instead of using a Virtual DOM, it compiles its templates to real DOM nodes and updates them with fine-grained reactions. Declare your state and use it throughout your app, and when a piece of state changes, only the code that depends on it will rerun. Check out our intro video or read on!
<div>
is a real div, so you can use your browser's devtools to inspect the renderingYou can get started with a simple app by running the following in your terminal:
1> npx degit solidjs/templates/js my-app 2> cd my-app 3> npm i # or yarn or pnpm 4> npm run dev # or yarn or pnpm
Or for TypeScript:
1> npx degit solidjs/templates/ts my-app 2> cd my-app 3> npm i # or yarn or pnpm 4> npm run dev # or yarn or pnpm
This will create a minimal, client-rendered application powered by Vite.
Or you can install the dependencies in your own setup. To use Solid with JSX (recommended), run:
1> npm i -D babel-preset-solid 2> npm i solid-js
The easiest way to get set up is to add babel-preset-solid
to your .babelrc
, babel config for webpack, or rollup configuration:
1"presets": ["solid"]
For TypeScript to work, remember to set your .tsconfig
to handle Solid's JSX:
1"compilerOptions": { 2 "jsx": "preserve", 3 "jsxImportSource": "solid-js", 4}
Meticulously engineered for performance and with half a decade of research behind it, Solid's performance is almost indistinguishable from optimized vanilla JavaScript (See Solid on the JS Framework Benchmark). Solid is small and completely tree-shakable, and fast when rendering on the server, too. Whether you're writing a fully client-rendered SPA or a server-rendered app, your users see it faster than ever. (Read more about Solid's performance from the library's creator.)
Solid is fully-featured with everything you can expect from a modern framework. Performant state management is built-in with Context and Stores: you don't have to reach for a third party library to manage global state (if you don't want to). With Resources, you can use data loaded from the server like any other piece of state and build a responsive UI for it thanks to Suspense and concurrent rendering. And when you're ready to move to the server, Solid has full SSR and serverless support, with streaming and progressive hydration to get to interactive as quickly as possible. (Check out our full interactive features walkthrough.)
Do more with less: use simple, composable primitives without hidden rules and gotchas. In Solid, components are just functions - rendering is determined purely by how your state is used - so you're free to organize your code how you like and you don't have to learn a new rendering system. Solid encourages patterns like declarative code and read-write segregation that help keep your project maintainable, but isn't opinionated enough to get in your way.
Solid is built on established tools like JSX and TypeScript and integrates with the Vite ecosystem. Solid's bare-metal, minimal abstractions give you direct access to the DOM, making it easy to use your favorite native JavaScript libraries like D3. And the Solid ecosystem is growing fast, with custom primitives, component libraries, and build-time utilities that let you write Solid code in new ways.
1import { render } from "solid-js/web"; 2import { createSignal } from "solid-js"; 3 4// A component is just a function that (optionally) accepts properties and returns a DOM node 5const Counter = props => { 6 // Create a piece of reactive state, giving us a accessor, count(), and a setter, setCount() 7 const [count, setCount] = createSignal(props.startingCount || 1); 8 9 // The increment function calls the setter 10 const increment = () => setCount(count() + 1); 11 12 console.log( 13 "The body of the function runs once, like you'd expect from calling any other function, so you only ever see this console log once." 14 ); 15 16 // JSX allows us to write HTML within our JavaScript function and include dynamic expressions using the { } syntax 17 // The only part of this that will ever rerender is the count() text. 18 return ( 19 <button type="button" onClick={increment}> 20 Increment {count()} 21 </button> 22 ); 23}; 24 25// The render function mounts a component onto your page 26render(() => <Counter startingCount={2} />, document.getElementById("app"));
See it in action in our interactive Playground!
Solid compiles our JSX down to efficient real DOM expressions updates, still using the same reactive primitives (createSignal
) at runtime but making sure there's as little rerendering as possible. Here's what that looks like in this example:
1import { render, createComponent, delegateEvents, insert, template } from "solid-js/web"; 2import { createSignal } from "solid-js"; 3 4const _tmpl$ = /*#__PURE__*/ template(`<button type="button">Increment </button>`, 2); 5 6const Counter = props => { 7 const [count, setCount] = createSignal(props.startingCount || 1); 8 const increment = () => setCount(count() + 1); 9 10 console.log("The body of the function runs once . . ."); 11 12 return (() => { 13 //_el$ is a real DOM node! 14 const _el$ = _tmpl$.cloneNode(true); 15 _el$.firstChild; 16 17 _el$.$$click = increment; 18 19 //This inserts the count as a child of the button in a way that allows count to update without rerendering the whole button 20 insert(_el$, count, null); 21 22 return _el$; 23 })(); 24}; 25 26render( 27 () => 28 createComponent(Counter, { 29 startingCount: 2 30 }), 31 document.getElementById("app") 32); 33 34delegateEvents(["click"]);
Check out our official documentation or browse some examples
SolidJS Core is committed to supporting the last 2 years of modern browsers including Firefox, Safari, Chrome and Edge (for desktop and mobile devices). We do not support IE or similar sunset browsers. For server environments, we support Node LTS and the latest Deno and Cloudflare Worker runtimes.
Come chat with us on Discord! Solid's creator and the rest of the core team are active there, and we're always looking for contributions.
Support us with a donation and help us continue our activities. [Contribute]
Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 12 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 11/27 approved changesets -- score normalized to 4
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More