title: React alternative to ES6 classes
body: <p>I have a this simple non-react ES6 class in a react-project that i use to create medication instances.</p>
  
  <pre><code>export default class Medication {
    constructor(props) {
      ...
    }
    someFunction() {} 
  }
  
  const medData = [{name: "med1"}, {name: "med2"}, {name: "med3"}];
  const meds = medData.map(med =&gt; new Medication(med));
  </code></pre>
  
  <p>I also have a setting-context or provider that keeps settings that are loaded once from a backend and provides it via a context. </p>
  
  <pre><code>export const SettingContext = React.createContext();
  
  export default class SettingsProvider extends Component {
    constructor(props) {
      super(props);
      this.state = {settings: {...}};
    }
    ...
    render() {
      return (
          &lt;SettingContext.Provider value={{setting: this.state.settings}}&gt;
            {this.props.children}
          &lt;/SettingContext.Provider&gt;
      );
    }
  }
  
  </code></pre>
  
  <p>Is there any way to use this context inside the Medication class, so that i can use the settings in there? What would be an alternative to ES6 classes where I could then use the context?</p>