Skip to content

Commit

Permalink
Update StatefulComponents.md
Browse files Browse the repository at this point in the history
minor typo
  • Loading branch information
smoothdeveloper authored Mar 24, 2024
1 parent e2da7db commit 6ef2549
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion public/Feliz/React/StatefulComponents.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stateful Components

Components can tremendously useful when they manage their internal state. This allows for some pieces of the UI to have stateful bevavior without polluting the global Elmish state. For example when you have an accordion component, whether it is collapsed or expanded is a piece of information that might not be relevant to your Elmish models so you keep that information internal to that specific component. Otherwise, if you are "going Elmish all the way", you would to keep track of which accordion is now in it's open state and have messages that are resposible for expanding and collapsing a specific accordion.
Components can be tremendously useful when they manage their internal state. This allows for some pieces of the UI to have stateful bevavior without polluting the global Elmish state. For example when you have an accordion component, whether it is collapsed or expanded is a piece of information that might not be relevant to your Elmish models so you keep that information internal to that specific component. Otherwise, if you are "going Elmish all the way", you would need to keep track of which accordion is now in it's open state and have messages that are resposible for expanding and collapsing a specific accordion.

State with React components is incorporated using [React Hooks](https://reactjs.org/docs/hooks-intro.html) which allow you to define state variables inside your functional components. A common hook to use with React is the `React.useState` hook.

Expand Down

0 comments on commit 6ef2549

Please sign in to comment.