Three professionals collaborating on a single sheet of paper

How to Use Tiptap's Collaboration Feature with Rails Action Cable

In this post, we’ll walk through setting up Tiptap’s collaboration feature with Rails Action Cable and ReactJS. Tiptap is a powerful headless editor built on ProseMirror, and when combined with Y.js, it allows for real-time collaborative editing. We’ll use the Mantine component library, but it isn’t mandatory for this setup. If you prefer to dive directly into the code, check out the example on GitHub. Prerequisites Ensure you have the following installed: ...

June 18, 2024 · 4 min · Vikas Kumar
Multiple stores

Handling multiple stores in a React-Redux application

In a React-Redux application, it is good practice to have only one Redux store. But if, for some unusual or special reason, you need more than one store, you will face some problems. The most common problem is that if we wrap a component with a provider and then wrap a child component with another provider, it’s not easy to subscribe to the top-level provider’s store. const Component1 = () => { return ( <Provider store={store1}> <Provider store={store2}> <Component2 /> </Provider> </Provider> ); }; This can become so confusing that, within a few development iterations, you’ll find yourself using providers on every component. Not being able to read values from both stores in a single component will also become frustrating. ...

October 12, 2021 · 2 min · Vikas Kumar

Difference between 'useEffect' and calling a function directly inside a component

In React, the useEffect hook is pretty straightforward. But its simplicity sometimes makes me forget its actual function. I thought of useEffect simply as something that takes a callback and a dependency array as arguments and executes the callback whenever the dependency array changes. Without a dependency array, it runs the callback each time the component renders. But then, what is the difference between the following two cases? ...

May 9, 2021 · 3 min · Vikas Kumar
OneSignal ReactJs

How to use OneSignal with ReactJs

Using OneSignal with React is fairly easy if you don’t have an existing service worker. But if one already exists, things may not work as expected. First, we will create a React app with a service worker. npx create-react-app my-app --template pwa This should create a folder named 'my-app' containing all the app-related files. To check that everything is working, we can run the following commands. A browser tab should open with the ReactJS logo. ...

January 9, 2021 · 3 min · Vikas Kumar