Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
storybook-addon-apollo-client
Advanced tools
Use Apollo Client in your Storybook stories.
yarn
yarn add --dev storybook-addon-apollo-client
npm
npm install -D storybook-addon-apollo-client
import { withApolloClient } from 'storybook-addon-apollo-client';
import MyComponentThatHasAQuery, {
MyQuery,
} from '../component-that-has-a-query';
export default {
title: 'My Story',
decorators: [withApolloClient],
};
export const example = () => <MyComponentThatHasAQuery />;
example.story = {
parameters: {
apolloClient: {
mocks: [
{ request: { query: MyQuery }, result: { data: { viewer: null } } },
],
},
},
};
preview.js
import { withApolloClient } from 'storybook-addon-apollo-client';
import { addDecorator } from '@storybook/react';
import { InMemoryCache } from 'apollo-cache-inmemory';
const cache = new InMemoryCache();
addDecorator(
withApolloClient({
cache,
...// take a look at all the options in https://www.apollographql.com/docs/react/development-testing/testing
// everything that is used in `storybook-addon-apollo-client` is a 1 to 1 mapping of MockedProvider
})
);
if you setup withApolloClient
in preview, it will not need to be added to the decorators
key in each story, consider doing this if you have a lot of stories that depend on Apollo.
Read more about the options available for MockedProvider at https://www.apollographql.com/docs/react/development-testing/testing
To see real world usage of how to use this addon, check out the example app:
FAQs
Use Apollo Client in your Storybook stories.
The npm package storybook-addon-apollo-client receives a total of 61,975 weekly downloads. As such, storybook-addon-apollo-client popularity was classified as popular.
We found that storybook-addon-apollo-client 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.