title: How to change values in config file dynamically in react?
body: <p>I have a template that has <code>config.js</code> file which loads theme configs I want to add toggle switch from Light mode to Dark mode. Theme changes when you make changes in <code>config.js</code> but I don't know how to change values in <code>config.js</code> dynamically.</p>
  
  <p>I'm Planning to have a toggle in the index file.</p>
  
  <p>config.js</p>
  
  <pre><code>export default {
      defaultPath: '/dashboard/default',
      basename: '',
      layout: 'vertical',
      preLayout: '', 
      collapseMenu: false,
      layoutType: 'dark', // menu-light
      navIconColor: true,
      headerBackColor: 'header-default', // header-dark
      navBackColor: 'navbar-dark', // navbar-dark
      navBrandColor: 'brand-dark', // brand-dark
      navBackImage: false, 
      rtlLayout: false,
      navFixedLayout: true,
      headerFixedLayout: false,
      boxLayout: false,
      navDropdownIcon: 'style1', 
      navListIcon: 'style1',
      navActiveListColor: 'active-*', // active-dark
      navListTitleColor: 'title-default', // title-dark
      navListTitleHide: false,
      configBlock: false,
      layout6Background : 'linear-gradient(to right, #A445B2 0%, #D41872 52%, #FF0066 100%)',
      layout6BackSize : '', 
  };
  </code></pre>
  
  <p>index.js</p>
  
  <pre><code>import React from 'react';
  import ReactDOM from 'react-dom';
  import { createStore } from 'redux';
  import {Provider} from 'react-redux';
  import {BrowserRouter} from 'react-router-dom';
  
  import App from './App/index';
  import * as serviceWorker from './serviceWorker';
  import reducer from './store/reducer';
  import config from './config';
  
  const store = createStore(reducer);
  
  const app = (
      &lt;Provider store={store}&gt;
          &lt;BrowserRouter basename={config.basename}&gt;
              {/* basename="/datta-able" */}
              &lt;App /&gt;
          &lt;/BrowserRouter&gt;
      &lt;/Provider&gt;
  );
  
  ReactDOM.render(app, document.getElementById('root'));
  </code></pre>