Reddit is down
reddit.com24 pointsby kfinley8 comments
const App = () => (
<BrowserRouter>
<h1>Hello World</h1>
<Match exactly pattern="/" component={Home} />
<Match pattern="/about" component={About} />
<Miss component={NoMatch}/>
</BrowserRouter>
)
Couldn't we take it one step farther and just use a switch statement? It seems like using pure JavaScript would be more idiomatic React. The URL pattern could be parsed in the data layer, and passed down as props. That way the components don't rely on global state, making them easier to test. const App = (screen, args) => {
let content;
switch (screen) {
case 'home':
content = <Home args={args} />
break;
case 'about':
content = <About args={args} />
break;
default:
content = <NoMatch args={args} />
break;
}
return (
<div>
<h1>Hello World</h1>
{content}
</div>
)
}
It's probably just a matter of preference. Recently I started using React-Storybook, so I've become addicted to "dumb" components. {
"workbench.editor.showTabs": false,
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
// ...
} declare module "some-module"
Does that help?
From the article
> The service will begin with deliveries from DashMart, DoorDash’s owned and operated convenience, grocery, and retail store that also powers DashMart Fulfillment Services, with plans to expand over time.