Meteor/V3/Update React

1.0.1Last update Sep 24, 2024
by@yugal41735

This codemod helps in transforming react to meteor

Example

Before

import { useTracker, useSubscribe } from 'meteor/react-meteor-data';
function Tasks() {
const isLoading = useSubscribe('tasks');
const { username } = useTracker(() => Meteor.user());
const tasksByUser = useTracker(() =>
TasksCollection.find({ username }, { sort: { createdAt: -1 } }).fetch(),
);
if (isLoading()) {
return < Loading / > ;
}
}

After

import { useTracker, useSubscribe } from 'meteor/react-meteor-data/suspense';
function Tasks() {
useSubscribe('tasks');
const { username } = useTracker('user', () => Meteor.userAsync());
const tasksByUser = useTracker('tasksByUser', () =>
TasksCollection.find({ username }, { sort: { createdAt: -1 } }, ).fetchAsync(),
);
}

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now