Try : Insurtech, Application Development

AgriTech(1)

Augmented Reality(20)

Clean Tech(8)

Customer Journey(17)

Design(43)

Solar Industry(8)

User Experience(66)

Edtech(10)

Events(34)

HR Tech(3)

Interviews(10)

Life@mantra(11)

Logistics(5)

Strategy(18)

Testing(9)

Android(48)

Backend(32)

Dev Ops(10)

Enterprise Solution(28)

Technology Modernization(7)

Frontend(29)

iOS(43)

Javascript(15)

AI in Insurance(38)

Insurtech(66)

Product Innovation(57)

Solutions(22)

E-health(12)

HealthTech(24)

mHealth(5)

Telehealth Care(4)

Telemedicine(5)

Artificial Intelligence(143)

Bitcoin(8)

Blockchain(19)

Cognitive Computing(7)

Computer Vision(8)

Data Science(19)

FinTech(51)

Banking(7)

Intelligent Automation(27)

Machine Learning(47)

Natural Language Processing(14)

expand Menu Filters

React 18: From A Developer’s PoV

React 18, the much-awaited version of React is out with exciting features like automatic batching, a new API –startTransition, and streaming server-side rendering with support for Suspense. What’s so special about this newer version is its unique “concurrent rendering” method. In the earlier versions of React, the rendering process was synchronous and non-interruptible where the UI would lock during long render processes and not respond to user input instantly. Using React 18, the rendering process can be made asynchronous and can be interrupted, paused, resumed, and even abandoned enabling developers to create a more fluid user experience.

How to update from React 17 to React 18?

React 18 is currently released in alpha and can be downloaded using the command 

image2.png

A component is usually rendered like this

image4.png

However, to utilize the latest features, components need to be rendered like this:

image3.png

What’s there in React 18?

Automatic Batching

Automatic Batching is the rendering that occurs at the same time whenever triggered to update with multiple states at once. The previous version of React could only batch updates inside React event handlers. If the multiple state updates are triggered by a promise or a callback, their responses are not rendered at the same time. But with React 18, all renders are batched, meaning they’ll occur at the same time, regardless of their trigger.

image12.png

Here’s an example with a promise:

image5.png

Suspense

With Suspense, React 18 makes major performance improvements to SSR by making serving parts of an app asynchronously possible. Suspense helps in specifying what React should show when a part of the tree isn’t ready to render. For instance, in case there are four components: a Header, a Sidebar, a Banner component, and the Main component. If all four of them are stacked on each other like this 

image9.png

Then, the server would try to render them at once, slowing the entire page down. If the Header, the Sidebar, and the Main are more important for the readers, one can prioritize these over the Banner by wrapping the Banner component in Suspense tags:

image6.png

As a result, the server would first serve the Header, Side Bar, and Main component, and then a spinner would be displayed while the Banner waits to load.

Transitions

React apps are interactive, however, to make an app update itself as people interact with it, constant updating might cause the app to slow down significantly and give a poor user experience. Transition is a new React feature that differentiates between urgent and non-urgent updates. Transition updates transform the UI from one view to the next.

  • Urgent updates are the direct interactions like typing, clicking, pressing, etc., that need immediate response to match one’s intuition about how physical objects behave. Otherwise, they feel “wrong”. However, transitions are different because the user doesn’t expect to see every intermediate value on the screen. 

Single-user input should typically result in both an urgent and a non-urgent update for the best user experience. StartTransition API can be used inside an input event to tell React which updates are urgent and which are “transitions”.

image8.png
  • Non-urgent updates are wrapped in ‘startTransition’ and would get interrupted if more urgent updates, such as clicks or keypresses, emerge. If a user interrupts a transition (for example, by typing multiple characters in a row), React will discard any stale rendering work and render only the most recent update.

New Hooks

  1. UseId

useId is a new hook for creating unique IDs on both the client and the server while avoiding hydration mismatches. It’s most beneficial for component libraries that need to integrate with accessibility APIs that require unique IDs. This addresses a major problem that existed in React 17 and in its previous versions, but it’s even more critical in React 18 because of how the new streaming server renderer delivers HTML out-of-order.

image10.png

 

  1. useTransition

‘useTransition’ and ‘startTransition’ would allow marking some state updates as not urgent. By default, other state updates are considered urgent. React would allow urgent state updates (for example, updating a text input) to interrupt the non-urgent state updates (for example, count results).

image11.png

 

  1. useSyncExternalStore

‘useSyncExternalStore’ is a new hook that enables external stores to support concurrent reads by forcing updates to the store to be synchronous. It eliminates the necessity for useEffect when implementing subscriptions to external data sources, and is recommended for any library that integrates with a state external to React.

image7.png

 

  1. useDeferredValue

‘useDeferredValue’ helps to delay re-rendering a non-urgent part of the tree. It works in the same way as debouncing, although it offers a few advantages. React will attempt the deferred render directly after the initial render is reflected on the screen because there is no predetermined time delay. The deferred render is interruptible and doesn’t block user input.

image13.png

 

 

  1. useInsertionEffect

‘useInsertionEffect’ is a new hook that allows CSS-in-JS libraries to address the performance difficulties of injecting styles in the render. Unless you’ve already built a CSS-in-JS library we don’t expect you to ever use this. This hook will activate after the DOM is mutated, but before layout effects read the new layout. useInsertionEffect is even more important in React 18 because React yields to the browser during concurrent rendering, giving it a chance to recalculate the layout.

image1.png

Conclusion

With the introduction of React 18, there has been a drastic change in the world of web applications because of its unique offerings like concurrent mode and server-side rendering. The latest feature would make it easier to develop and maintain a code as well as make apps faster and more responsive to user interactions.

About the author:

Manikandan is a Technical Lead at Mantra Labs working on React/Angular-related projects. He is interested in learning about stock analyst trading algorithms, and in his free time, he loves to swim, cook, and play cricket and chess.

Cancel

Knowledge thats worth delivered in your inbox

What If the Sun Took a Day Off?

By :

Ever wondered what life would be like if the Sun took a day off? Picture waking up to an Earth shrouded in darkness, where temperatures drop dramatically within hours, plunging the planet into an icy chill. Plants, deprived of sunlight, would halt photosynthesis, leading to a food production crisis. Our reliance on renewable energy would face a sudden halt, causing widespread blackouts and chaos in cities across the globe.

A day without the Sun would throw our world into chaos! Luckily, that’s never going to happen (at least in our lifetime!). But this thought experiment underscores the Sun’s critical role in our lives and highlights why harnessing solar energy is so vital. While we’re increasingly turning to solar power, we are still missing out on capturing a massive amount of solar energy that falls on Earth every single day.

How Much Solar Energy Are We Missing Out On?

Every day, the Earth receives about 173,000 terawatts of solar energy from the Sun—more than 10,000 times the world’s total daily energy consumption. Despite this abundance, we only capture a tiny fraction of this energy. In 2023, solar energy accounted for just 4.5% of global electricity generation—a huge opportunity waiting to be tapped.

If we could capture just a small percentage of the Sun’s energy, we could power the entire world many times over. The total solar energy that hits the Earth in just one hour could meet the world’s energy needs for a full year. Yet, due to limitations in solar panel deployment, technology efficiency, and energy storage, the vast majority of solar energy goes unused each day.

As we improve solar technology and infrastructure, capturing more of this energy becomes not just a possibility but a necessity for a sustainable future. Let’s dive into how cutting-edge technology is making solar energy more accessible and efficient, helping to turn this untapped potential into real, usable power.

How Tech Makes Solar Adoption Easier

Customer-centric technology is revolutionizing the way we adopt solar energy. Imagine an app that allows you to simply point your smartphone at your house to estimate how many solar panels you need, their ideal placement, and the energy they can generate.

Here are the key benefits of this innovative approach:

  • Precision: By capturing images of your property through satellite, the app calculates the optimal placement of solar panels for maximum energy production. Studies have shown that precise placement can increase efficiency by up to 20%.
  • Customer Engagement: Users receive real-time insights into their energy production, helping them understand their solar power system better, whether they’re using Tesla solar panels, solar power generators, or even solar attic fans to optimize home energy usage
  • Seamless Experience: With user-friendly interfaces, consumers can easily monitor their solar systems remotely and receive updates on their energy output. This accessibility is crucial for encouraging the wider adoption of solar technologies.

The Tech-Driven Shift Toward Sustainability

As solar technology evolves, so do the solar panels themselves. Innovations like Tesla solar roof systems, flexible solar plates, and bifacial panels are redefining what’s possible in renewable energy. Even smaller systems—such as portable solar generators and solar air conditioners—empower homeowners to harness solar power efficiently.

Photovoltaic (PV)  panels, the cornerstone of solar energy, have seen incredible advancements, now boasting efficiencies of up to 22%. This means fewer panels are needed to produce more energy, making solar energy more effective for a wide range of applications, from solar shingles to off-grid systems.

Moreover, the push towards cradle-to-cradle sustainability is reshaping the industry. New solar panels are being designed with recyclability in mind, reducing their environmental footprint. Innovations in recycling technology now recover up to 95% of materials from end-of-life panels, ensuring that even the oldest solar systems contribute to a greener future.

While solar technology continues to advance, solar panels themselves are becoming more efficient and environmentally sustainable. Innovations such as systems, flexible solar plates, and bifacial solar panels are pushing the boundaries of what’s possible in renewable energy. Even smaller systems like portable solar generators and solar air conditioners are empowering homeowners to tap into the power of the Sun efficiently and sustainably.  Photovoltaic (PV) panels, the cornerstone of solar energy – now boast efficiencies of up to 22%​. This means a smaller array of solar panels for home or commercial use can generate more electricity. This makes solar energy systems more appealing and effective for various applications, from solar roof shingles to off-grid solar systems.

Moreover, the move toward cradle-to-cradle sustainability—where solar panels are built from materials that can be easily recycled—has gained traction. This reduces the environmental footprint even further. Innovations in recycling can recover up to 95% of materials from end-of-life panels, According to PV Cycle​, with room for improvement in recycling.

Making Solar Affordable and Accessible

Historically, one of the biggest barriers to solar adoption has been the cost. But things are changing fast. Innovations in financing models, such as Power Purchase Agreements (PPAs) and solar loans, have significantly reduced the financial burden of installing solar systems. According to the Solar Energy Industries Association (SEIA), the average cost of solar installation has dropped by over 70% in the last decade.

Couple that with federal and state incentives like the Investment Tax Credit (ITC), which provides a 30% tax credit on solar installations, and solar energy is more affordable than ever. Net metering programs, which allow homeowners to sell excess energy back to the grid, further enhance savings, making solar not only accessible but also financially rewarding.

Conclusion

The future of solar energy goes far beyond rooftop panels—it’s about making the entire solar experience intuitive, accessible, and sustainable. With smart apps and tech-driven tools, consumers can now manage their solar energy systems with just a few taps on their phones, making the shift to green energy simpler and more engaging.

At Mantra Labs, we’re at the forefront of this solar revolution. We’ve helped some of the world’s largest solar providers develop cutting-edge, customer-friendly solutions. Our mobile apps allow users to estimate solar panel needs, monitor system performance, and even track their environmental impact—all from the convenience of their smartphone.

Together, with innovative tech and a commitment to sustainability, we’re building a future where solar energy isn’t just an option—it’s the smarter, more accessible, and greener solution for everyone.

Cancel

Knowledge thats worth delivered in your inbox

Loading More Posts ...
Go Top
ml floating chatbot