2020-01-28
1876
#react#typescript
John Reilly
13074
Jan 28, 2020 ⋅ 6 min read

Integrating web workers in a React app with Comlink

John Reilly MacGyver turned Dev 🌻❤️ TypeScript / ts-loader / fork-ts-checker-webpack-plugin / DefinitelyTyped: The Movie

Recent posts:

Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 ⋅ 5 min read
Deno logo over an orange background

How to migrate your Node.js app to Deno 2.0

Deno is a popular JavaScript runtime, and it recently launched version 2.0 with several new features, bug fixes, and improvements […]

Yashodhan Joshi
Dec 17, 2024 ⋅ 7 min read
Angular icon over blue background

Generating OpenAPI API clients for Angular

Generate OpenAPI API clients in Angular to speed up frontend development, reduce errors, and ensure consistency with this hands-on guide.

Shalitha Suranga
Dec 16, 2024 ⋅ 9 min read
Implementing Infinite Scroll In React Snap Carousel

Implementing infinite scroll in React with React Snap Carousel

Making carousels can be time-consuming, but it doesn’t have to be. Learn how to use React Snap Carousel to simplify the process.

David Omotayo
Dec 13, 2024 ⋅ 10 min read
View all posts

2 Replies to "Integrating web workers in a React app with Comlink"

  1. Just what I was looking for!

    For those interested, this is how I got lazy loading to work without typescript:

    “`
    const worker = new Worker(‘../../pathtoWorker’, { name: ‘my-worker’, type: ‘module’ });
    const workerApi = wrap(worker)

  2. This really helps me and save my time. I like other articles too.
    One small thing to change in snippet.

    After I changed
    “`
    const total = useTakeALongTimeToAddTwoNumbers(number1, number2);
    “`
    to
    “`
    const {total} = useTakeALongTimeToAddTwoNumbers(number1, number2);
    “`

    I can avoid an error.

Leave a Reply