当我嵌套路由时,如何传递props给组件?<Outlet />
// Parent Comp
{
const [format, setFormat] = useState('rgb');
const color = [hex, rgb, rgba]
// ...
return (
<PaletteNavBar changeFormat={setFormat}/>
{colorId ? <ColorBoxes /> : <Outlet color={color[format]} />}
// setFormat(hex) is called down here
<PaletteFooter />;
)
}
Run Code Online (Sandbox Code Playgroud)
我不想通过 URL 参数传递它们。