
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
storybook-addon-cookie
Advanced tools
Starting with storybook-addon-cookie v3, it supports storybook v7.
Use v2.x if you're using storybook v6.x.
document.cookie
for each Storybook.With npm:
npm i storybook-addon-cookie -D
Or with yarn:
yarn add storybook-addon-cookie -D
Add package to storybook configuration.
// .storybook/main.js
module.exports = {
addons: [
// ..other addons
'storybook-addon-cookie',
],
};
If you want to use it only in a specific story, you can provide cookieDecorator
to story.
But you can't control cookie by the panel.
// Component.stories.jsx
import React from 'react';
import Component from './Component';
import { cookieDecorator } from 'storybook-addon-cookie';
export default {
title: 'Component',
compoent: Component,
decorators: [cookieDecorator],
};
You can pass cookie object into cookie
parameter.
Or control cookie by addon panel.
export default {
component: Example,
title: 'Example',
};
const Template = () => <Example />;
export const WithCookie = Template.bind({});
WithCookie.parameters = {
cookie: {
test: 'TEST!',
},
};
export const WithOutCookie = Template.bind({});
Each Story has independent cookie.
FAQs
Storybook addon for setting document.cookie
The npm package storybook-addon-cookie receives a total of 44,800 weekly downloads. As such, storybook-addon-cookie popularity was classified as popular.
We found that storybook-addon-cookie demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.