Live data from Hacker News

Base Web, Uber’s New Design System for Building Websites in React

eng.uber.com

21–30 of 156 posts

Re: Base Web, Uber’s New Design System for Building Websites in React

#21

I'm surprised that many huge React libraries don't expose its core Context for user to consume. Context is the most important concept in React. Actually, a library just need users to provide the right types of Context to be flexible. I'm tired of the "lock in" API, in which, it doesn't allow me to just get my context data into its arguments API. In this sense, you can consider Context as the local version of Redux.

As someone who stopped doing React development before Context became a "thing", is it possible to ELI5 in a couple sentences why it is such an important concept?

Re: Base Web, Uber’s New Design System for Building Websites in React

#22

Earlier quoted context omitted.

Sigh. I really wish people would just accept the fact that JavaScript is a dynamically typed language and stop making things unnecessarily difficult.

[flagged]

Godwin's law strikes again. Static typing is great, don't get me wrong, but it's not always the right solution. There are cases where runtime flexibility can be useful.

Re: Base Web, Uber’s New Design System for Building Websites in React

#23

Imagine creating this beast of a "framework" and not even using TypeScript or Flow. What are you thinking? Edit: It does use Flow.

My only issue is TS usage with extremely large/complex components/containers. For example, files around 500 lines of code, I've temporarily removed TS, done a few other optimizations (ternaries for obvious If/Else statements, etc) to reduce to ~200-230 lines total. The file is instantly easier to reason about and modify.

I wish there was a plugin that just did this automatically so you could toggle it back on when done. To clarify, it's mostly when working with 3rd party/other libs, where you don't have the background of the team.

Re: Base Web, Uber’s New Design System for Building Websites in React

#24
post #12
post #9

I've been searching for a basic React UI component system for awhile now. There are a lot of systems available, but each one has significant drawbacks to the point I end up just rolling my own. I think an ideal system would have a core set of "unstyled" components with the necessary functionality baked in. That way the overall aesthetic is up to you, but a lot of the painstaking UI work (e.g. showing, hiding, and hig…

There’s some work being done around renderless ui components but I’ve yet to see a complete framework.

Renderless? What are these good for?

Re: Base Web, Uber’s New Design System for Building Websites in React

#25

I'm surprised that many huge React libraries don't expose its core Context for user to consume. Context is the most important concept in React. Actually, a library just need users to provide the right types of Context to be flexible. I'm tired of the "lock in" API, in which, it doesn't allow me to just get my context data into its arguments API. In this sense, you can consider Context as the local version of Redux.

As someone who stopped doing React development before Context became a "thing", is it possible to ELI5 in a couple sentences why it is such an important concept?

It's important, because you don't need to care about props vs state, instead, just consume the context deep in your component tree.

One use case, is, suppose you have two independent contexts at two branches, now, if you want to share those data to 3rd branch, you just create new context with value from the first two contexts.

Re: Base Web, Uber’s New Design System for Building Websites in React

#26
post #6

Can you use this outside of React? I'm interested in the styles, but I'm not using React.

This is why Web Component interest is growing, especially w/ enterprises and large teams. The killer app for WC's is building Design Systems that don't force specific frontend framework decisions.

Re: Base Web, Uber’s New Design System for Building Websites in React

#27
post #23

Imagine creating this beast of a "framework" and not even using TypeScript or Flow. What are you thinking? Edit: It does use Flow.

My only issue is TS usage with extremely large/complex components/containers. For example, files around 500 lines of code, I've temporarily removed TS, done a few other optimizations (ternaries for obvious If/Else statements, etc) to reduce to ~200-230 lines total. The file is instantly easier to reason about and modify. I wish there was a plugin that just did this automatically so you could toggle it back on when do…

Basically a complex version of this example, done over and over, for larger methods.

  togglePanel = (newTogglePanelComponentState: Boolean) => {
    return this.setState({ panelToggleState: newTogglePanelComponentState });
  }

  togglePanel = bool => this.setState({ panelToggle: bool })

Re: Base Web, Uber’s New Design System for Building Websites in React

#28

I'm surprised that many huge React libraries don't expose its core Context for user to consume. Context is the most important concept in React. Actually, a library just need users to provide the right types of Context to be flexible. I'm tired of the "lock in" API, in which, it doesn't allow me to just get my context data into its arguments API. In this sense, you can consider Context as the local version of Redux.

Are you talking about the theme? Can you be more specific?

Re: Base Web, Uber’s New Design System for Building Websites in React

#29
post #28

I'm surprised that many huge React libraries don't expose its core Context for user to consume. Context is the most important concept in React. Actually, a library just need users to provide the right types of Context to be flexible. I'm tired of the "lock in" API, in which, it doesn't allow me to just get my context data into its arguments API. In this sense, you can consider Context as the local version of Redux.

Are you talking about the theme? Can you be more specific?

I mean, when you use this library, you want to "inject" your own context into its system.

Then in all components props, you'll have your own context value at every level deep in the tree.

Re: Base Web, Uber’s New Design System for Building Websites in React

#30
post #6

Can you use this outside of React? I'm interested in the styles, but I'm not using React.

This is why Web Component interest is growing, especially w/ enterprises and large teams. The killer app for WC's is building Design Systems that don't force specific frontend framework decisions.

Yup this is the future. WC's are finally supported everywhere with Edge switching to chromium under the hood.
Post reply on HN