![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@dvtng/cosmos
Advanced tools
Proof of concept for a flexible data-fetching framework for React.
Data sources are described using models:
const Weather = model({
type: "Weather",
refresh: { minutes: 5 },
get({ latitude, longitude }) {
return fetch(`https://weather.example.com/${latitude}/${latitude}`).then(
(resp) => resp.json()
);
},
});
Models can then be queried inside components:
function WeatherIcon({ latitude, longitude }) {
const [weather] = useModel(Weather({ latitude, longitude }));
return <img src={weather ? weather.iconUrl : placeholderIconUrl} />;
}
We can use suspense if preferred using waitFor
:
function WeatherIcon({ latitude, longitude }) {
const [weather] = waitFor(useModel(Weather({ latitude, longitude })));
return <img src={weather.iconUrl} />;
}
Models can also represent data sources that continuously emit data, such as websockets or event listeners:
const MyLocation = model({
type: "MyLocation",
emitter(emit) {
const id = navigator.geolocation.watchPosition((position) => {
emit(position.coords);
});
// Stop watching when this model is no longer used
return () => {
clearWatch(id);
};
},
});
If we frequently need to get the weather at the current location, we can combine these two models into one:
const MyWeather = model({
type: "MyWeather",
derive(getModel) {
const [coords] = waitFor(getModel(MyLocation()));
return getModel(Weather(coords));
},
});
function MyWeatherIcon() {
const [myWeather] = waitFor(useModel(MyWeather()));
return <img src={myWeather.iconUrl} />;
}
Cosmos automatically tracks the dependencies of MyWeather so that it updates whenever either MyLocation or Weather updates.
It also tracks usages of each model so that they are initialized once when used by a component, and then cleaned up when no longer needed.
FAQs
Proof of concept for a flexible data-fetching framework for React.
We found that @dvtng/cosmos demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.