question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

core: add new fields to MitosisComponent type: slots

See original GitHub issue
export const createMitosisComponent = (
  options?: Partial<MitosisComponent>,
): MitosisComponent => ({
  '@type': '@builder.io/mitosis/component',
  imports: [],
  inputs: [],
  meta: {},
  state: {},
  children: [],
  hooks: {},
  context: { get: {}, set: {} },
  name: options?.name || 'MyComponent',
  subComponents: [],
  ...options,
});

a component needs to have all named slots available and I think it should be added here. and inside of children we need Slot nodes

'@type': '@builder.io/mitosis/component',
  slots: {
    mySelectorName: createMitosisComponent({})
  },
  children: [
    createMitosisNode({
      name: 'Slot',
      properties: {
        name: 'mySelectorName'
      } 
    });
  ],

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sahilmobcommented, May 9, 2022

@steve8708 Sure thing. would love to add an eslint rule in the future 🚀 🚀 🚀

1reaction
steve8708commented, May 9, 2022

great idea. only thing is this should probably be on @builder.io/mitosis/node right? aka when you have

<Layout slotFoo={<Bar />} />

it would become

    {
      "@type": "@builder.io/mitosis/node",
      "name": "Layout",
      "meta": {},
      "properties": {},
      "slots": {
        "foo": { "@type": "@builder.io/mitosis/node", name: "Bar" ... }
      },
      "children": []
    }

this would be a great eslint rule to eventually add too (cc @sahilmob), essentially that

<div foo={<Jsx />} />

is not allowed, you can only put jsx expressions as binding values if the binding name starts with slot

Read more comments on GitHub >

github_iconTop Results From Across the Web

mitosis/components.md at main - GitHub
Write components once, run everywhere. Compiles to Vue, React, Solid, Angular, Svelte, and more. - mitosis/components.md at main · BuilderIO/mitosis.
Read more >
BIL 151 - Mechanisms of Mitosis - This is bio.miami.edu
In this project, you and your teammates will predict the outcome of treating a rapidly dividing tissue (onion root tip) with a substance...
Read more >
Lysosomal Changes in Mitosis - Cells - MDPI
When cells enter mitosis, most cellular processes that are not directly ... Mitotic cells decrease levels of lysosomal proteins, increase lysosome size, ...
Read more >
Mechanisms of Cellular Senescence: Cell Cycle Arrest and ...
Depending on the cell type and intensity and nature of the stress, ... complex also requires phosphorylation of the LIN52 component of the...
Read more >
Talking Drupal #353 - Native Web Components
Because you know, in core Drupal nine, Drupal eight, you can add a ... and slots where you're going to really kind of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found