this is probably a very basic question. im making a settings page for my site and I need some help.
<Route path="/conversations/settings" render={props => <Setting isNew colorMode=
{props.colorMode} toggleColorMode={props.toggleColorMode}/>}/>
so what I want this to do ideally is when you click a button on the settings page it enables/disables darkmode. In this situation it doesnt. but if I write it like this
<Setting colorMode={props.colorMode} toggleColorMode={props.toggleColorMode}/>
I can actually enable/disable darkmode, but this means the settings page renders on every page of the website which of course, I dont want.
Since you say that
<Setting colorMode={props.colorMode} toggleColorMode={props.toggleColorMode}/>works I'll assume that wherever you are rendering thisSettingcomponent thatpropsis in scope and has the prop values you want.If you are wanting to render
Settingon a route and pass other non-route-props though then you are correct to use therenderprop to do so. The issue you've now is that you are accessing the passed route props instead of yourpropsobject that is in scope. Rename the route props to something other than thepropsof the outer parent component and spread these into yourSettingcomponent if you need them.