Split into components
Our application is simple for now. But typically, applications are more complex and have multiple components. Let's split the application into different components.
Create new components
Let's start by creating a new component that will show the quote. We continue to overwrite the src/Main.tsx file just to keep things simple to follow.
Replace the src/Main.tsx file content with the following:
As you can see, SeqFlow components can be created as sync or async functions that accept two parameters:
- the component properties;
- the context object used to interact with the component.
In the above code, we created:
- the
Loadingcomponent to show a loading message; - the
ErrorMessagecomponent to show an error message. - the
Quotecomponent to show the quote;
Finally, we updated the Main component accordingly.
Conclusion
We split the application into multiple components.
In the next guide, we will learn how to handle user interactions.