DEV Community

Cover image for SolidJs: First impression
Edem Agbenyo
Edem Agbenyo

Posted on

SolidJs: First impression

I have been using React.js for the past 3 years for various projects, and the main reason why I decided to do so were:

  • The ability to use JSX
  • The power to create composable components
  • One-way data binding
  • Reactivity and Virtual DOM
  • Simplicity and Performance

I recently explored SolidJS, a JS library framework and I discovered that you can do all these and even more. Here are my initial thoughts on SolidJS:

  • SolidJS is a declarative, efficient and flexible JavaScript library for building user interfaces.
  • It looks more like functional React components
  • It has its own hooks, the difference being they start with create* while React hooks start with use*
  • SolidJS has 2 main building blocks: JSX Components and Reactive Primitives
  • Components: just like in React are functions that accept props and return JSX elements or other components
  • The Reactive Primitives are made up of Signals(equivalent to State in React), memos and Effects.

There is more to SolidJS, as the above are my initial findings. I will be diving deeper into the topic in my subsequent articles.

Top comments (2)

Collapse
 
lexlohr profile image
Alex Lohr

React components will return virtual DOM, whereas SolidJS components return actual DOM. Instead of reconciliation between virtual and actual DOM, the babel-based compiler creates the scripts required to react on changes to props or changes of memoized signals on compilation. The initial component is only rendered once and changes are applied directly to the DOM.

I recently started writing a selection of components for solid, but it's still in a very early state: github.com/atk/solid-blocks - feel free to give it a spin.

Collapse
 
edemagbenyo profile image
Edem Agbenyo

I will surely take a look at it.