Skip to content

Instantly share code, notes, and snippets.

@mateusz-wierzbicki
Created November 11, 2023 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mateusz-wierzbicki/e3396e212f92c96d03fbc4a77189c064 to your computer and use it in GitHub Desktop.
Save mateusz-wierzbicki/e3396e212f92c96d03fbc4a77189c064 to your computer and use it in GitHub Desktop.
import {Button, ConfigProvider} from 'antd';
import React, {useState} from 'react';
import App from './App';
import light from './tokens/light.json';
import dark from './tokens/dark.json';
const ThemedApp = () => {
const [token, setToken] = useState(light);
return (
<ConfigProvider theme={{token}}>
<Button onClick={() => token === light ? setToken(dark) : setToken(light)}
style={{margin: 20}}>
Change theme
</Button>
<App/>
</ConfigProvider>
);
};
export default ThemedApp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment