
Security News
AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.
@ematipico/react-multi-labels
Advanced tools
Provide static labels to your application, whichever language you want
Provide static labels to your application, whichever language you want
React multi labels rely on the React 16.3.*, this means that if you use an earlier version, it won't work.
Fist of all you have to initialize the provider by giving it the default language of our labels and the labels themselves:
import { LabelsProvider } from 'react-multi-labels';
import { App } from './app';
import React from 'react';
import { render } from 'react-dom';
const labels = {
en_GB: {
REMOVE: 'Remove',
CREATE: 'Create',
CHANGE: 'Change',
EDIT: 'Edit'
},
it_IT: {
REMOVE: 'Rimuovi',
CREATE: 'Crea',
CHANGE: 'Cambia',
EDIT: 'Modifica'
}
}
// 'en_GB' will be the first language
render(
<LabelsProvider language={'en_GB'} labels={labels}>
<App />
</LabelsProvider>
document.getElementById('app')
)
The library provides different high order components to consume your labels.
import { Label } from 'react-multi-labels';
function Button() {
return (
<button>
<Label text={'REMOVE'} />
</button>
);
}
// result will be <button>Remove</button> for 'en_GB'
// result will be <button>Rimuovi</button> for 'it_IT'
It simply returns the label that you want. It doesn't return any markup. Only text. If it doesn't exist, it will return undefined
High Order Component to return the label, so you can provide it all your components
import { GetLabels } from 'react-multi-labels';
import { Button } from './Button';
function Form() {
return (
<GetLabel text={'REMOVE'}>
{label => {
return <Button buttonLabel={label} />;
}}
</GetLabel>
);
}
Sometimes you need to retrieve multiple labels in one go. You can use this guy. It's an high order component that requires an array of the labels that you want and it returns an object, so you can identify your labels with their own name.
import { GetLabels } from 'react-multi-labels';
import { Button } from './Button'
import React from 'react'
function Form () {
return (
<GetLabels list={['REMOVE', 'CREATE']}>
{({ REMOVE, CREATE }) => {
return (
<React.Fragment>
<Button buttonLabel={CREATE} />
<Button buttonLabel={REMOVE} />
</React.Fragment>
)
}}
</GetLabel>
)
}
import { GetLabels, ChangeLanguage } from 'react-multi-labels';
import { Button } from './Button';
import React from 'react';
function Form() {
return (
<GetLabels list={['REMOVE', 'CHANGE']}>
{({ REMOVE, CHANGE }) => {
return (
<React.Fragment>
<Button buttonLabel={REMOVE} />
<ChangeLanguage>
{changeLanguage => {
<Button
buttonLabel={CHANGE}
onClick={() => changeLanguage('it_IT')}
/>;
}}
</ChangeLanguage>
</React.Fragment>
);
}}
</GetLabels>
);
}
import { GetLabels, ChangeLabels, LabelsProvider } from 'react-multi-labels';
import { Button } from './Button';
import React from 'react';
const LABELS = {
en_GB: {
LOGIN: 'Login'
EMAIL: 'Email'
}
};
const NEW_LABELS = {
en_GB: {
LOGIN: 'Fancy Login'
EMAIL: 'Fancy Email'
}
};
<LabelsProvider language="en_GB" labels={LABELS}>
<React.Fragment>
<GetLabels list={['LOGIN', 'EMAIL']}>
{({ LOGIN, EMAIL }) => {
return (
<p>
{LOGIN} - {EMAIL}
</p>
);
}}
</GetLabels>
<ChangeLabels>
{({ changeLabels }) => {
return (
<button onClick={() => changeLabels(newLabels)}>
Click me!
</button>
);
}}
</ChangeLabels>
</React.Fragment>
</LabelsProvider>
FAQs
Provide static labels to your application, whichever language you want
The npm package @ematipico/react-multi-labels receives a total of 9 weekly downloads. As such, @ematipico/react-multi-labels popularity was classified as not popular.
We found that @ematipico/react-multi-labels 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
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.