![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.
history-adaptor
Advanced tools
Adaptor connects two of BrowserHistory, HashHistory and MemoryHistory with custom mapping rules
To use this library you should know
Seperate different sets of URIs and connect them with others loosly, by following the desired rules.
npm install --save history-adaptor
const rules = [
{from: {key: 'Portal', pattern: '/webapp/main/blog/home'}, to: {key: 'Blog', pattern: '/news'}},
{from: {key: 'Portal', pattern: '/webapp/main/blog'}, to: {key: 'Blog', pattern: '/main'}},
{from: {key: 'Portal', pattern: '/webapp/main/blog/tags'}, to: {key: 'B', pattern: '/tags'}},
{from: {key: 'Blog', pattern: '/news'}, to: {key: 'Portal', pattern: '/webapp/main/blog/home'}},
{from: {key: 'Blog', pattern: '/post/11'}, to: {key: 'Portal', pattern: '/webapp/main/blog/post?id=11'}},
];
const createAdaptOf = sourceKey => location => {
const matched = rules
.filter(rule => {
if (rule.from.key === sourceKey) {
if (typeof location === 'string') {
return rule.from.pattern === location;
}
return location.pathname && (rule.from.pattern === location.pathname);
}
return false;
})
.map(rule => rule.to.pattern);
if (matched.length > 0) {
return matched[0];
}
return undefined;
};
// I believe you don't want to connect multiple BrowserHistories, or multiple HashHistories with each other.
// They munipulates the same thing -> The browser address bar.
// You can, but you should not.
import createBrowserHistory from 'history/createBrowserHistory';
import createMemoryHistory from 'history/createMemoryHistory';
import {connect} from 'history-adaptor';
const [portalHistory, blogHistory] = connect( // The order remain the same.
[
{
key: 'Portal', // Define a key for your source history
history: [createBrowserHistory, {}], // You can also provide a history instance instead of the array.
adaptors: [ // Provide the targets to which your URIs adapting to.
{
target: 'Blog', // Define a key for your target history
adapt: createAdaptOf('Portal'), // fn: (location) => (location)
// Pure function which accept a location-like object(or string) then return a new one.
// See history.push(...) on the manual page of 'history' package.
},
],
},
{
key: 'Blog',
history: [createMemoryHistory, {}],
adaptors: [
{
target: 'Portal',
adapt: createAdaptOf('Blog'),
},
],
},
// You can provide more ones
],
);
history.push(...);
history.replace(...);
history.go(n);
history.goForward();
history.goBack();
history.listen(...);
or
const Blog = (
<Router history={blogHistory}>
<div>
<nav>
<ul>
<li><Link to="/">Main</Link></li>
<li><Link to="/news">News</Link></li>
<li><Link to="/tags">Tags</Link></li>
<li><Link to="/post/11">One Post</Link></li>
</ul>
</nav>
<Route exact path="/" component={Main}/>
<Route path="/news" component={News}/>
<Route path="/tags" component={Tags}/>
<Route path="/post/:id" component={Post}/>
</div>
</Router>
);
const Portal = (
<Router history={portalHistory}>
<div>
<ul>
<li><Link to="/webpapp/main/home">Home</Link></li>
<li><Link to="/webpapp/main/blog">Blog Home</Link></li>
</ul>
<Route exact path="/webpapp/main/home" component={Home}/>
<Route path="/webpapp/main/blog" component={Blog}/>
</div>
</Router>
);
FAQs
Adaptor connects two of BrowserHistory, HashHistory and MemoryHistory with custom mapping rules
The npm package history-adaptor receives a total of 2 weekly downloads. As such, history-adaptor popularity was classified as not popular.
We found that history-adaptor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.