Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@spotify-confidence/react
Advanced tools
This package contains helper functionality to make the Confidence SDK work well in a React environment.
To add the packages to your dependencies run:
yarn add @spotify-confidence/react
The Confidence React integration has a Provider that needs to be initialized. It accepts a Confidence instance and should wrap your component tree.
import { Confidence } from '@spotify-confidence/sdk';
const confidence = Confidence.create({
clientSecret: 'mysecret',
region: 'eu',
environment: 'client',
timeout: 1000,
});
function App() {
return (
<ConfidenceProvider confidence={confidence}>
<React.Suspense fallback={<p>Loading... </p>}>
<MyComponent />
</React.Suspense>
</ConfidenceProvider>
);
}
The useConfidence()
hook supports the standard context API's. Additionally, the following wrapper component can be used to wrap a sub tree with additional context data.
<ConfidenceProvider.WithContext context={{ user_name: 'John Doe' }}>
<UserDetails />
</ConfidenceProvider.WithContext>
Flags are accessed with a set of hooks exported from @spotify-confidence/react
useFlag(flagName, defaultValue)
will return the flag value or default.useEvaluateFlag(flagName, defaultValue)
will return more details about the flag evaluation, together with the valueBoth of the flag hooks integrate with the React Suspense API so that the suspense fallback will be visible until flag values are available. It is therefore important to wrap .
Accessing flags will always attempt to provide a up to date value for the flag within the defined timeout, or else default values.
The event tracking API is available on the Confidence instance as usual. See the SDK Readme for details.
const confidence = useConfidence();
confidence.track('my-event-name', { my_data: 4 });
FAQs
Unknown package
The npm package @spotify-confidence/react receives a total of 126 weekly downloads. As such, @spotify-confidence/react popularity was classified as not popular.
We found that @spotify-confidence/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.