How to send props to a component on the basis of system wide theme?
I know how to style my components with media query for dark and light themes with @media prefers-color-scheme , but I am working with react-json-vew library and component, it takes a theme prop, which I need to change when the system wide dark mode is toggled.
Its a custom component so I would not like to style it on my own, that would also increase the code's length.
Snippet :
import ReactJson from "react-json-view";
import React from "react";
class JsonDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
checked: false,
copied: false
};
}
render(){
return <ReactJson src={json} theme={"apathy:inverted"} /> // here I need to apply theme on the basis of dark or light mode
}
}