Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Setting Up Feature Flags with React

talianassi
October 12, 2020

Setting Up Feature Flags with React

As developers, we release features daily – but how do you ensure those features are working properly in production before you release them to all your users? If you ask me, the answer is feature flags! Feature flags are beneficial because they allow you to test your code in production, perform canary releases, and even conduct A/B testing. The power of React makes it easy to implement these flags. We will walk through how to easily create a feature flag in the UI, install dependencies with npm, and implement your feature flag in your react app.

talianassi

October 12, 2020
Tweet

More Decks by talianassi

Other Decks in Technology

Transcript

  1. FEATURE FLAG USE CASES TESTING IN PROD KILL SWITCH SUBSCRIPTION

    MANAGEMENT MIGRATION TO MICROSERVICES A/B TESTING CANARY RELEASES EXPERIMENTATION
  2. Why? • feature flags improve your ability to develop, test,

    and deliver new features while minimizing risk throughout the process. • Provides a good foundation for Continuous Delivery
  3. PROCESS CREATE A FEATURE FLAG INSTANTIATE AND USE THE SDK

    INSTALL DEPENDENCIES AND CONFIGURE YOUR REACT APP
  4. renderContent(deleteTreatment) { const allowDelete = deleteTreatment.treatment === 'on'; return (

    <div className= "todoListMain" > <div className= "header"> <form onSubmit={ this.addItem}> <input ref={(a) => this._inputElement = a} placeholder= "Enter Task"> </input> <button type= "submit">Add</button> </form> </div> < TodoItems entries={this.state.items} allowDelete={allowDelete} delete={this.deleteItem} /> </div> ) }
  5. createTasks(item) { return <li key={item.key}>{item.text} {this.props.allowDelete && <button onClick={() =>

    this.delete(item.key)}>x</button>} </li> } render() { var todoEntries = this.props.entries; var listItems = todoEntries.map(this.createTasks); return ( <ul className="theList"> {listItems} </ul> ); }
  6. 1. INCLUDE TICKET NUMBER 2. INCLUDE THE NAME OF THE

    SERVICE 3. INCLUDE THE NAME OF THE TEAM THAT THE FLAG BELONGS TO 4. INCLUDE THE NAME OF THE FUNCTIONALITY 5. ENGAGE WITH THE DIFFERENT STAKEHOLDERS 6. BE SURE THERE IS CLEAR OWNERSHIP CREATION
  7. 1. CHANGES TO FF SHOULD BE TREATED LIKE CODE DEPLOYS

    2. MAKE FLAGGING DECISIONS ON THE SERVER 3. DON’T CHANGE THE SCOPE OF YOUR COMPONENTS JUST TO SUPPORT FEATURE FLAGGING DECISIONS IMPLEMENTATION
  8. IMPLEMENTATION - TESTING Choose the most important flows to automate

    and test Work with your product owner to prioritize what these flows are Target your automation bots inside the feature flags
  9. 1. USERS SHOULD CONSISTENTLY HAVE THE SAME EXPERIENCE 2. BUILD

    A FEEDBACK LOOP 3. SET UP ALERTS TO PAGE YOU WHEN YOU GET ANY STATISTICALLY SIGNIFICANT CHANGES ROLLOUT
  10. 1. ASSIGN AN EXPIRATION DATE FOR EACH FLAG 2. SET

    UP ALERTS THAT WILL POKE YOU WHEN A FLAG IS STALE 3. ADD A SUBTASK TO YOUR BACKLOG TO RETIRE THE FLAG AT THE SAME TIME THE FLAG IS CREATED 4. BE SURE TO REMOVE THE OLD CODE WHEN YOU DELETE THE FEATURE FLAG CLEANUP
  11. USEFUL LINKS: Feature Flag Maintenance - https://www.youtube.com/watch?v=qb-VNbMSzy0 Free Split Account

    - www.split.io (try feature flagging for free!) Link to Repo - https://github.com/talianassi921/todolist