Skip to content

Commit

Permalink
feat: authorize route with more explicit names
Browse files Browse the repository at this point in the history
  • Loading branch information
friedrith committed Feb 26, 2025
1 parent 71371e2 commit 6c7729e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 31 deletions.
68 changes: 37 additions & 31 deletions .slides/slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ layout: cool-demo
url: https://friedrith.github.io/react-composition/#/0?demo=1
---

# Input Text
# Text Input

```tsx
export interface InputProps {
Expand Down Expand Up @@ -298,36 +298,6 @@ export default function Example() {
layout: two-cols
---

# Code Not scalable

<div v-click>

For each new feature:
- one property
- condition in the main function

</div>

<div v-click>

Impact on the development:
- spaghetti code
- one file: one bottleneck
- harder to read
- harder to maintain

</div>

<div v-click>

> Flag Argument: a common code smell in all languages (not only React)
</div>



::right::

```tsx
export interface InputProps {
value: string | number
Expand Down Expand Up @@ -374,11 +344,47 @@ h1 + p {
opacity: 1!important;
margin-top: 1rem!important;
}

blockquote {
margin-top: 2rem!important;
}

.slidev-code-wrapper {
position: relative;
right: 2rem;
}
</style>

::right::

# Code Not scalable


<div v-click>

For each new feature:
- one property
- condition in the main function

</div>

<div v-click>

Impact on the development:
- spaghetti code
- one file: one bottleneck
- harder to read
- harder to maintain

</div>

<div v-click>

> Flag Argument: a common code smell in all languages (not only React)
</div>


---

# How to do better? SOLID
Expand Down
7 changes: 7 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ const App = () => {
element={<Layout title={title} component={component} />}
/>
))}
{routes.map(({ title, component }, index) => (
<Route
key={title}
path={`/${title.toLowerCase().replace(/ /g, '-')}`}
element={<Layout title={title} component={component} />}
/>
))}
<Route path='*' element={<Navigate to='/0' replace={true} />} />
</Routes>
</Page>
Expand Down

0 comments on commit 6c7729e

Please sign in to comment.