Skip to content

Commit

Permalink
Fix typo in passing_data_between_components.md
Browse files Browse the repository at this point in the history
  • Loading branch information
timmy471 committed Nov 27, 2024
1 parent 9bcde5e commit 680b6b9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function App() {

### Default props

You may have noticed in the above examples that there is some repetition when defining props on the `Button` components within `App`. In order to stop repeating ourselves re-defining these common values, and to protect our application from undefined values, we can define default parameters to set default values for props.
You may have noticed in the above examples that there is some repetition when defining props on the `Button` components within `App`. In order to stop repeating ourselves by re-defining these common values, and to protect our application from undefined values, we can define default parameters to set default values for props.

```jsx
function Button({ text = "Click Me!", color = "blue", fontSize = 12 }) {
Expand Down Expand Up @@ -247,7 +247,7 @@ export default function App() {
}
```
When supplying an argument to the function we can't just write `onClick={handleClick('www.theodinproject.com')}`, and instead must attach a reference to an anonymous function which then calls the function with the argument. Like the previous example, this is to prevent the function being called during the render.
When supplying an argument to the function, we can't just write `onClick={handleClick('www.theodinproject.com')}`, and instead must attach a reference to an anonymous function which then calls the function with the argument. Like the previous example, this is to prevent the function being called during the render.
<div class="lesson-note" markdown="1" >
Expand Down

0 comments on commit 680b6b9

Please sign in to comment.