As you can see now, increase()
and decrease()
methods are called directly within the UI component. However, output data is handle by a stream builder.
It is better to have an intermediate layer to implement custom handlers to handle errors.
In the app.js
file, the BLoC is initialized using the CounterBloc
class. Thus, the Counter
component is used by passing the BLoC as a prop.
That’s it. Now you can treat your business logic as a separate entity outside your UI components and change it as you need.
14
21 reads
CURATED FROM
IDEAS CURATED BY
The idea is part of this collection:
Learn more about computerscience with this collection
Understanding machine learning models
Improving data analysis and decision-making
How Google uses logic in machine learning
Related collections
Similar ideas to Step 04: Implementing UI components.
Snapshot testing is an advanced kind of testing enabled by Jest.
A "component snapshot" is a textual representation of your component’s render output generated during a test run.
With snapshot testing, you typically fir...
Read & Learn
20x Faster
without
deepstash
with
deepstash
with
deepstash
Personalized microlearning
—
100+ Learning Journeys
—
Access to 200,000+ ideas
—
Access to the mobile app
—
Unlimited idea saving
—
—
Unlimited history
—
—
Unlimited listening to ideas
—
—
Downloading & offline access
—
—
Supercharge your mind with one idea per day
Enter your email and spend 1 minute every day to learn something new.
I agree to receive email updates