Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@crystal-ball/feature-flag
Advanced tools
feature-flag is a feature flag component for React.
A <FeatureFlag>
component will render any child components if the passed path
property is enabled in a feature flag object passed to the setupFlags
function.
The feature flag object could be stored in an object in a separate javascript
file, a json file, or returned from an api request.
$ npm install --save @crystal-ball/feature-flag
$ yarn add @crystal-ball/feature-flag
Render a <FeatureFlag>
component with a path
property. The passed path
should match a property in the feature flags object passed to setupFlags
before the app starts up. If the path exists and it's truthy, the component's
children will render.
setupFlags
takes an optional first argument to change the name of the key
used to store the feature flags as json in localStorage. By default, the key is
crystal-ball/feature-flags
.
import React, { Component } from 'react';
import { setupFlags, FeatureFlag } from '@crystal-ball/feature-flag';
setupFlags({
someFeature: true
});
class App extends Component {
render() {
return (
<div>
<FeatureFlag path="someFeature">
<div>Your cool feature</div>
</FeatureFlag>
</div>
);
}
}
In the developer console you can enable any of the features you've defined by
executing window.enableFeature('someFeature')
and refresh the page. Since
all of the flags are stored in localStorage, clear your cache or your
localStorage to reset the app back to the original feature flag configuration
passed to setupFlags
.
FAQs
Simple React component for feature flags
The npm package @crystal-ball/feature-flag receives a total of 2 weekly downloads. As such, @crystal-ball/feature-flag popularity was classified as not popular.
We found that @crystal-ball/feature-flag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.