![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.
react-title-config
Advanced tools
Set document title based on current path and configuration schema
npm install react-title-config
import React from "react"
import TitleConfig from "react-title-config"
// NOTE: it might be any router you want
import { BrowserRouter } from "react-router-dom"
// your main page or whatever
import MainPage from "/pages/Main"
const config = [
{
path: "/about",
exact: true,
skipPrefix: true,
title: "About us",
},
{
exact: true,
path: ["/login", "/registration", "/reset-password"],
title: "User actions",
},
{
path: /^\/accounts\/[A-Za-z0-9]+/i,
title: "Account page",
},
{
path: pathname => pathname.length === "42",
title: (params, descriptor, extras) => {
const tab = params.queryParams.tab
switch (tab) {
case "one": return "The Hitchhiker's Guide to the Galaxy"
case "two": return "The Restaurant at the End of the Universe"
case "three": return "Life, the Universe and Everything"
case "four": return "So Long, and Thanks for All the Fish"
case "five": return "\tMostly Harmless"
default: return "Not sure about this one"
}
},
},
]
const defaultTitle = "No matches"
const titlePrefix = "Prefixed. "
const App = () => (
<BrowserRouter>
<>
<TitleConfig
config={titlesConfig}
defaultTitle={defaultTitle}
prefix={titlePrefix}
customProperty="All extra props will be passed to title functtion as second parameter"
/>
<MainPage/>
</>
</BrowserRouter>
)
config (required)
: Array
An array of title descriptors
defaultTitle
: String
| default: ''
This title will be set in case there's no matches
prefix
: String
| default: ''
A static string prefixing each title without skipPrefix: true
path (required)
: String | RegExp | PathFunction | Array<string | RegExp | PathFunction>
A path to match with current pathname.
PathFunction
accepts current pathname as parameter and returns whether the pathname matches: (pathname: String) => Boolean
title (required)
: String | TitleFunction
A title which will be rendered in case of match.
TitleFunction
accepts current location params, matched descriptor and object containing all extra props passed to component: (params: PathParams, descriptor: ConfigDescriptor, extras: Object) => Boolean
PathParams
is an object of following shape:
{
hash: String,
href: String,
pathname: String,
queryParams: Object
}
exact
: Boolean
| default: false
Defines matching rule for plain strings. With exact
set to true title will be set only in case of full match.
path: "/accounts"
will match /accounts/9379992
by default and it will match only /accounts
in case of exact: true
skipPrefix
: Boolean
| default: false
Current title will not be prefixes if skipPrefix
is set to true
MIT © Alex Khismatulin
FAQs
Set document title based on current path and configuration schema
The npm package react-title-config receives a total of 2 weekly downloads. As such, react-title-config popularity was classified as not popular.
We found that react-title-config 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.