Hacker Newsnew | comments | show | ask | jobs | submit | _mayo's comments login

What benefit does "logic driven inline styles" over using style sheets buy you? That seems unmaintainable for a large project.

-----


Good question. Intuitively, having inline styles over style sheets goes against common patterns involving maintainability of large code bases, ditching mixins, variables, and other helpful functions that preprocessors like Sass provide you with.

The idea is that you gain extra maintainability points by co-locating your styling with your logic and DOM, a pervasive design patter in React in general. If I want to style a particular view, I no longer have to concern myself with which stylesheets contain styling for that view. I can simply go to the React Component where that view is owned, and see the styling for it right there.

See also:

- https://speakerdeck.com/vjeux/react-css-in-js

- https://github.com/FormidableLabs/radium

-----


I know this project uses browserify but by switching to webpack you could achieve the same thing without inline styles by exporting a style bundle. Take a look at the sass-loader[1] package which will let you configure webpack so that you can simply do a require('./style.scss'); and have the style included into either the main or a separate bundle.

[1] https://github.com/jtangelder/sass-loader

-----


Sweet! I keep hearing good things about Webpack, including good integration with React Hot Loader[1]. Will create a ticket in repo to assess switching over to Webpack :)

[1] https://github.com/gaearon/react-hot-loader

-----


I think it's supposed to be a representation of a few lines of text.

-----


Do you have a link?

-----


Yeah, it has been in Canary and beta channel for a while now. But not all developers run Canary.

-----


irony?

-----


The bulletproof way would probably be to use a library to handle drag and drop. If you're not wanting to use jQuery UI just for DnD functionality, there are a couple libraries that do drag and drop exclusively.

1. http://gtramontina.github.io/draggable.js/ 2. http://kbjr.github.io/DragDrop/index.html

-----


We looked at both of these libraries and it seems neither supports hover and drop events, so it seems like the front runner is still jQuery UI.

-----


This is pretty cool. There's a demo of it running on a Nexus 7[0]. -- [0] https://www.youtube.com/watch?v=Uaple0Ec1Dg

-----


“I have started a job with Apple, and will not be continuing work on this project.”

-----


Wouldn't that be considered fraud? Since you'd be defrauding Amex (genuinely curious).

-----


Amex still gets their swiping fee from Amazon, I don't think they care particularly much. I would assume Amazon just swallows the possible loss. (hence: introductory rate)

-----


If you're in to the history of Apple's software or Apple development in general, I can't recommend debug[0] enough.

[0] http://www.imore.com/debug/

-----


Even if you are not into Apple, it's great listening.

http://www.imore.com/debug-29-jeff-mcleman-porting-kernels is a must-listen

-----


Ah, I'm getting linked to an article Nice Laundry, not duck duck go.

-----

More

Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: