
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
reactjs-stylesheet
Advanced tools
React.js Stylesheet object: a react-native-like and intuitive way to write jsx style in reactjs
reactjs-stylesheet is a package that simplifies the way you can write your style for react components in javascript. It takes inspiration from react-native Stylesheet and adds some extra features.

Required Node.js v10+ to run.
npm i reactjs-stylesheet
In styles.ts or styles.js:
import Stylesheet from "reactjs-stylesheet";
const styles = Stylesheet.create({
container: {
backgroundColor: "#81D4FA",
color: "#263238",
height: "100px",
},
button: {
backgroundColor: "#039BE5",
borderRadius: "5px",
cursor: "pointer",
},
textDiv: {
backgroundColor: "#64B5F6",
width: "180px",
},
});
export default styles;
In index.ts, or index.js:
import React, { useState } from "react";
import styles from "./styles";
const MyComponent = () => {
const [theme, setTheme] = useState("light");
return (
<div style={styles.container}>
<div>
<button
style={styles.button}
onClick={() => {
alert("clicked");
}}
>
Styled button
</button>
<div style={styles.textDiv}>
Styled with <br /> reactjs-stylesheet!
</div>
</div>
</div>
);
};
export default MyComponent;
import React, { useState } from "react";
import Stylesheet from "reactjs-stylesheet";
const themes: {
[themeName: string]: {
[key: string]: string,
},
} = {
light: {
primary: "#E3F2FD",
secondary: "#64B5F6",
},
dark: {
primary: "#ECEFF1",
secondary: "#90A4AE",
},
};
const MyComponent = () => {
const [theme, setTheme] = useState("light");
const styles = Stylesheet.createWithTheme(themes[theme], (colors) => {
return {
container: {
backgroundColor: colors.background,
color: colors.textColor,
},
button: {
backgroundColor: colors.touchable,
},
text: {
backgroundColor: colors.secondary,
color: colors.textColor,
},
};
});
return <div style={styles.container}>myComponent</div>;
};
In styles.ts or styles.js:
import Stylesheet from "reactjs-stylesheet";
import { Colors } from "reactjs-stylesheet/lib/types";
const getStyles = (colors: Colors) => {
//return the styles you want to use
return Stylesheet.createWithTheme(colors, (colors) => {
return {
container: {
backgroundColor: colors.background,
color: colors.textColor,
},
button: {
backgroundColor: colors.touchable,
},
text: {
backgroundColor: colors.secondary,
color: colors.textColor,
},
};
});
};
export default getStyles;
In index.ts, or index.js:
//in index.ts (or .js)
import React, { useState } from "react";
import getStyles from "./styles";
const themes: {
[themeName: string]: {
[key: string]: string,
},
} = {
light: {
primary: "#E3F2FD",
secondary: "#64B5F6",
},
dark: {
primary: "#ECEFF1",
secondary: "#90A4AE",
},
};
const MyComponent = () => {
const [theme, setTheme] = useState("light");
const styles = getStyles(themes[theme]);
return <div style={styles.container}>myComponent</div>;
};
export default MyComponent;
MIT Free Software, try it out!
FAQs
React.js Stylesheet object: a react-native-like and intuitive way to write jsx style in reactjs
We found that reactjs-stylesheet 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.