Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@storybook/react-vite
Advanced tools
Storybook for React and Vite: Develop React components in isolation with Hot Reloading.
@storybook/react-vite is a package that integrates Storybook with Vite for React projects. It allows developers to build and test UI components in isolation with the fast and modern build tool Vite.
Setup Storybook with Vite
This command initializes a new Storybook configuration in your React project using Vite as the builder. It sets up the necessary files and dependencies to get started with Storybook and Vite.
npx sb init --builder @storybook/react-vite
Writing Stories
This code demonstrates how to write a story for a Button component in a React project. It defines a default export with metadata about the component and creates a template for the story. The `Primary` story is an instance of the template with specific arguments.
import React from 'react';
import { Button } from './Button';
export default {
title: 'Example/Button',
component: Button,
};
const Template = (args) => <Button {...args} />;
export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'Button',
};
Running Storybook
This command starts the Storybook development server, allowing you to view and interact with your stories in the browser. It uses Vite for fast builds and hot module replacement.
npm run storybook
@storybook/react is the standard Storybook package for React projects. It uses Webpack as the default builder, which may be slower compared to Vite but is more mature and has broader plugin support.
storybook-builder-vite is another package that integrates Vite with Storybook. It is an alternative to @storybook/react-vite and offers similar performance benefits by leveraging Vite's fast build times.
See documentation for installation instructions, usage examples, APIs, and more.
FAQs
Storybook for React and Vite: Develop React components in isolation with Hot Reloading.
The npm package @storybook/react-vite receives a total of 1,198,549 weekly downloads. As such, @storybook/react-vite popularity was classified as popular.
We found that @storybook/react-vite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.