Releases: Flagsmith/flagsmith-js-client
2.0.9 Fix error with incrementTrait
2.0.8 ESM module support
With this release, users are now able to npm install from flagsmith-es, this is a mirrored npm module except it is bundled as an ES module.
Thanks @bradberger for the suggestion 🚀
2.0.6: Closes https://github.com/Flagsmith/flagsmith-js-client/issues/103
2.0.5 - Minor fixes and React Improvements
This release includes a few underlying type fixes as well as a solution to #105
You can now supply identity / trait options to flagsmith.init.
flagsmith.init({... identity:"my_user", traits: {age:21}})
Also if you're using the react hooks / provider, you can now initialise flagsmith outside of the component. To do so you will call flagsmith.init and not pass options to your FlagsmithProvider e.g.
flagsmith.init({
environmentID: "QjgYur4LQTwe5HpvbvhpzK",
cacheFlags:true,
identity: "my_user",
traits: {{trait1:"value}}
})
...
<FlagsmithProvider flagsmith={flagsmith}>
<App />
</FlagsmithProvider>
2.0.0 - react hook support for React+React Native
React and React Native users will now be able to use a hook based approach to retrieving flags
import React from 'react';
import flagsmith from 'flagsmith' // 'react-native-flagsmith'; for react-native
import {FlagsmithProvider} from 'flagsmith/react';
import AppComponent from './ExampleComponent';
export default function () {
return (
<FlagsmithProvider
options={{
environmentID: 'QjgYur4LQTwe5HpvbvhpzK',
}}
flagsmith={flagsmith}>
<AppComponent />
</FlagsmithProvider>
);
}
Then in your app
const flags = useFlags(['font_size'], ['example_trait']); // only causes re-render if specified flag values / traits change
...
<div>font_size: {flags.font_size?.value}</div>
2.0.0-beta.2
Fixes passing undefined to traits in useFlags, thanks @NileDaley 🚀 #102
2.0.0-beta.1
This release includes a rewrite to the build system of the SDK. It is now typescript-first and generates much better d.ts output.
This also includes a new react hooks library with easy to use nextjs support.
<FlagsmithProvider flagsmith={flagsmith}
serverState={flagsmithState as IState}
options={{
environmentID,
cacheFlags: true
}}>
<App/>
</FlagsmithProvider>
...
const flags = useFlags(["font_size"],["example_trait"]) // only causes re-render if specified flag values / traits change
...
<div className="App">
font_size: {flags.font_size?.value}
example_trait: {flags.example_trait}
</div>
1.7.4
Release 1.7.3 - Remove Bullet Train instances, small type fixes
This non-breaking change release removes mentions of Bullet Train where possible, the release contains the following PR:
#94