Comments (2)
Great intuition. Several of us have thought about this opportunity and are thinking about approaches very similar to what you suggest. One of the benefits of defining style rules and css class specifications in JavaScript, is that you can use the full power of JavaScript to define styles, which we already have ways to model dependencies for. We wouldn't need another language like SASS or Less. Also, as you mention, since we also own the rendering/abstraction framework, we can ensure that we don't polute the CSS namespace. We can also ensure that components don't target nodes/class names that should be considered an implementation detail (concern) of a deeper component.
from react.
You can do the following right now:
getStyle: function() {
return {
fruit: {border: '1px solid black'}
}
},
render: function() {
return <div style={this.getStyle()}>Hello</div>;
}
Let's close this out until someone comes with a real proposal :)
from react.
Related Issues (20)
- Bug: In the unmount function returned by createRoot, an imprecise comparison statement causes the first unmount failed, affecting subsequent program operations. HOT 1
- Bug: Getting 409 Error for CustomPouchError with pouchdb-browser HOT 1
- Bug: [React 18] `act` in tests can alter autobatching behavior compared to production in 18.3.1
- Bug: infinite re-renders when queueing state updates via promises during render
- Bug: Context.Consumer re-rendering children with unchanged context value in react 19. HOT 2
- [Compiler Bug]: Functions defined in render that return primitives don't have usages memoized
- Bug: React 19 - Suspense Siblings Fall Back to Sequential Loading Under Load HOT 1
- Feature Request
- Bug: [React Refresh] React Refresh edge case, class fields are mistakenly treated as React Component
- Bug: Server functions error when returning a client reference
- Bug: Server functions report false positive errors for MobX observables
- Bug: Detached DOM Elements(leading memory leaks) when HTML element removed from DOM HOT 2
- Bug: React date input not working with iOS voiceover HOT 2
- Bug: onSelect does not fire when contentEditable equals "plaintext-only"
- Bug: useOptimistic shows wrong value when other actions happen in the background HOT 1
- [DevTools Bug]: Unnecessary Re-render Highlight on Sibling Component in React DevTools HOT 2
- Bug: "Rendered more hooks than ..." throws when it shouldn't with multiple suspends HOT 2
- [Compiler Bug]: Compiler optimizes away useMemo with manual dependencies HOT 1
- [Compiler Bug]: Compiler tries to assign to variables that does not exist HOT 2
- Bug: Rendered more hooks than during the previous render when component calls use(thenable) after hydration inside a transition
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.