Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SolidJS Support #160

Open
softmarshmallow opened this issue Jun 10, 2022 · 0 comments
Open

SolidJS Support #160

softmarshmallow opened this issue Jun 10, 2022 · 0 comments

Comments

@softmarshmallow
Copy link
Member

softmarshmallow commented Jun 10, 2022

Solid JS frameworks support

https://www.solidjs.com/

Codegen

https://www.solidjs.com/tutorial/bindings_style

Styling

inline-style

unlike react, solidjs uses the default css property name (kebab-case) with "" - "font-size" (react: fontSize)

<div style={{
  color: `rgb(${num()}, 180, ${num()})`,
  "font-weight": 800,
  "font-size": `${num()}px`}}
>
  Some Text
</div>

styled-components
Solid offers an official wrap of styled-components implementation of its own. - solid-styled-components

differences from react: styled-compoents are..

  • use named imports (not default import)
  • use call signature instead of property signature styled.div -> styled("div")
  • has built-in css obj support -> import { css } from "solid-styled-components";
import { styled } from "solid-styled-components";

const Btn = styled("button")`
  border-radius: 4px;
`;

styled-jsx (by vercel) unofficial wrapper

https://github.com/solidjs/solid-styled-jsx

function Button() {
  const [isLoggedIn, login] = createSignal(false);
  return (
    <>
      <button className="button" onClick={() => login(!isLoggedIn())}>
        {isLoggedIn() ? "Log Out" : "Log In"}
      </button>
      <style jsx dynamic>
        {`
          .button {
            background-color: ${isLoggedIn() ? "blue" : "green"};
            color: white;
            padding: 20px;
            margin: 10px;
          }
        `}
      </style>
    </>
  );
}

States & Events

Lifecycles

Testing

Unique Elements

  • <For>
  • <Show>
  • <Switch>/<Match>
  • <Index>
  • <ErrorBoundary>
  • <Suspense>
  • <Dynamic>
  • <Protal>

Special Attributes

  • ref
  • classList
  • style
  • on:x
  • use:x
  • prop:x
  • attr:x
  • /* @once */

Runtime & Env / Editor

WIP

tsx/jsx
https://www.solidjs.com/guides/typescript#configuring-typescript

{
  "compilerOptions": {
    "jsx": "preserve",
    "jsxImportSource": "solid-js"
  }
}

Examples

  • working examples
  • realworld app examples (human written)

References

Resources

Note: Differences from react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant