facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.22k stars 303 forks source link

Support Older React Versions #488

Closed stevenanthonyrevo closed 3 months ago

stevenanthonyrevo commented 3 months ago

Describe the feature request

Can StyleX support older versions of react similar to Style-Components?

React v18 is only supported option.

nmn commented 3 months ago

We already support older versions of React. Since we don't depend on any React features at all, StyleX can be used with any version of React and many other frameworks such Svelte, Solid, Qwik, etc.

As long as you are able to do the bundler setup, there are no restrictions about which component framework, or version you're using.

React v18 is only supported option.

Where did you get this idea? @stylexjs/stylex has no dependency on React at all.

stevenanthonyrevo commented 3 months ago

I have a component in React v16.4 and installed via npm "dependencies": { "@stylexjs/stylex": "^0.5.1", }, "devDependencies": { "@stylexjs/dev-runtime": "^0.5.1", "@stylexjs/webpack-plugin": "^0.5.1" } however I am getting the error Module not found: Error: Can't resolve 'stylex' in and webpack compiled with 1 error

import * as stylex from 'stylex';

const styles = stylex.create({
  red: {color: 'red'},
});
<div {...stylex.props(styles.red)}>Test</div>
necolas commented 3 months ago

The package name is @stylexjs/stylex