React Strict DOM (RSD) standardizes the development of styled React components for web and native. The goal of RSD is to improve the speed and efficiency of React development without compromising on performance, reliability, or quality. Building with RSD is helping teams at Meta ship features faster, to more platforms, with fewer engineers.
Please refer to the React Strict DOM website for detailed documentation. The API section includes detailed compatibility tables for native. Please read the linked issues for details on the most significant issues, and register your interest (e.g., thumbsup reaction) in supporting these features on native platforms.
Styles are passed to elements using the style
prop. The style
prop accepts an array of static and dynamic styles.
import { css, html } from 'react-strict-dom';
const styles = css.create({
root: {
marginBlock: '1rem'
},
cond: {
borderWidth: '5px'
},
opacity: (value) => ({
opacity: value
})
})
export default function App(props) {
const opacity = useOpacity();
return (
<html.div
{...props}
style={[
styles.root,
cond && styles.cond,
styles.opacity(opacity)
]}
/>
);
}
React Strict DOM is MIT licensed.