skip to Main Content

in my (freshly setup) local bit.dev environment, my component wont render under the preview tab section. The preview seems to work in the "Compositions" section in the preview tab.

Button Component Code

import type { ReactNode } from 'react';

export type ButtonProps = {
  /**
   * sets the component children.
   */
  children?: ReactNode;
};

export function Button({ children }: ButtonProps) {
  return (
    <div>
      {children}
    </div>
  );
}

Button Composition Code:

import { Button } from './button.js';

export const BasicButton = () => {
  return (
    <Button>hello world!</Button>
  );
}

Overview Tab:
enter image description here

Preview Tab
enter image description here

2

Answers


  1. There is some problem with bitdev.react/[email protected]. Try to downgrade env for your component and it should work for now.

    bit envs set components/input/button bitdev.react/[email protected]
    
    Login or Signup to reply.
  2. You can now upgrade to the latest bitdev.react/react-env and resolve the preview issue.

    bit envs set components/input/button bitdev.react/[email protected]

    Also make sure that you are using @teambit/react.mounter v1.0.5 (in case you have it in your dependencies).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search