This is a big one. It includes the Control Flow Refactor described in #42. It brings Solid up to date with the latest version JSX DOM Expressions. Read the release notes here. What this means:
- Optimized List reconciliation is exposed for any array passed as child nodes. This includes Fragments which are now also just arrays. This addresses issues like #37. One side effect is that dynamic bindings are not activated until attached and are made inert when detached. If you need to maintain context I suggest wrapping in a
createMemo
so that the value is remembered between inserts. - Solid ships with Control Flow operators. However, you are not limited to them. While you should be conscious of wasted work, you can use any Components/functions to handle control flow. The control flow operators are much simpler now since they are independent of DOM manipulation.
- To support purely Reactive array iteration I reintroduced the
map
operator. I've addedpipe
andreduce
as well. These are very basic but can serve as a basis for users to create Functional operators. They are in the same vein as RxJS pipe-able operators. - The return type from JSX may be a Node, Function, or Array of those. Since not all JSX expressions return Nodes anymore the top level now needs to use
insert
fromsolid-js/dom
instead of just appending the returned element.solid-js/dom
now exportsrender
for convenience which does both theinsert
and automatically wraps it withcreateRoot
. This syntax is based on React's render. - While still not perfect, some big improvements to TypeScript support, by removing both Custom Directives (use forwardRef binding instead) and
<$>
tag. New Control Flow also now has explicit type defs. JSX Children are now handled consistently with react. - Newly released is also babel-preset-solid. This will take care of all the Solid specific configuration for the JSX plugin making it easier than ever to get started.
There have been several small changes, but those are the highlights. Bear with me as I update all the examples over the next few days.