Live data from Hacker News

Build Your Own React

pomb.us

51–60 of 114 posts

Re: Build Your Own React

#51

Earlier quoted context omitted.

> webcomponent based router Routers can be (and should be, IMO) written to be independent of UI component libraries such as React and webcomponents. See an example here: https://github.com/Rajeev-K/mvc-router You can use it with React---and in some ways it works better than react-router.

Yeah I'm not a fan at all of react-router because it's too dependent on React. For redirecting, for example, they recommend you render a component. Which is just bananas to me.

It's not really bananas when you actually start to think of everything 'as components', and consider that 'render' can neatly, declaratively describe behaviour, not just the DOM.

Re: Build Your Own React

#52

Earlier quoted context omitted.

> webcomponent based router Routers can be (and should be, IMO) written to be independent of UI component libraries such as React and webcomponents. See an example here: https://github.com/Rajeev-K/mvc-router You can use it with React---and in some ways it works better than react-router.

My favorite routers to use with React at the moment are redux-first-router (define a route map, and an object in your Redux store gets automatically two-way synced with browser location state; your 'routing' is actually just a switch statement over the current location state), and Next.js (make some component files under pages/ and they get automatically rendered as routes; wrap a filename in brackets and it's used a…

Disagree there's anything really low-mental-overhead about bringing redux into your project.

Re: Build Your Own React

#53

Forget building my own React, I want to build how you did the presentation! It’s a great concept!

Here's the Gatsby theme https://www.gatsbyjs.org/packages/gatsby-theme-waves/ (and on GitHub https://github.com/pomber/gatsby-waves)

Great article and awesome storytelling there!

Re: Build Your Own React

#54

Earlier quoted context omitted.

This might even become standard for most documentations.

> This might even become standard for most documentations. I hope not, because slow, meaningless animation makes me tired and something inside me wants escape that page. Also it affects scrolling, especially noticeable when I am scanning a text instead of reading - you might lose context (note how the presentation reacts on pressing "page-up" / "page-down"). Kindle and all e-reader hates animations[0][1] - any animat…

No worries, i understand, but I felt it told the code History in a valuable way. I usually stay away from shiny presentation.

Re: Build Your Own React

#55
post #5

Very, very nice. His presentation library is available as well! https://codesurfer.pomb.us/ https://github.com/pomber/code-surfer/blob/code-surfer-v2/re...

Is it just me or on mobile it does not render properly?

Re: Build Your Own React

#56

Earlier quoted context omitted.

> webcomponent based router Routers can be (and should be, IMO) written to be independent of UI component libraries such as React and webcomponents. See an example here: https://github.com/Rajeev-K/mvc-router You can use it with React---and in some ways it works better than react-router.

Web components are not a UI library though. They are the native component model for the web.

HTML custom elements (basis for web components) are intended for things that should be added to DOM. Using it for any other purpose is probably a misuse.

Re: Build Your Own React

#57
post #51

Earlier quoted context omitted.

Yeah I'm not a fan at all of react-router because it's too dependent on React. For redirecting, for example, they recommend you render a component. Which is just bananas to me.

It's not really bananas when you actually start to think of everything 'as components', and consider that 'render' can neatly, declaratively describe behaviour, not just the DOM.

could you recommend any articles/tutorials that describe this approach some more?

Re: Build Your Own React

#58

Earlier quoted context omitted.

> webcomponent based router Routers can be (and should be, IMO) written to be independent of UI component libraries such as React and webcomponents. See an example here: https://github.com/Rajeev-K/mvc-router You can use it with React---and in some ways it works better than react-router.

My favorite routers to use with React at the moment are redux-first-router (define a route map, and an object in your Redux store gets automatically two-way synced with browser location state; your 'routing' is actually just a switch statement over the current location state), and Next.js (make some component files under pages/ and they get automatically rendered as routes; wrap a filename in brackets and it's used a…

Can second redux-first-router being fantastic.

Re: Build Your Own React

#59
post #51

Earlier quoted context omitted.

Yeah I'm not a fan at all of react-router because it's too dependent on React. For redirecting, for example, they recommend you render a component. Which is just bananas to me.

It's not really bananas when you actually start to think of everything 'as components', and consider that 'render' can neatly, declaratively describe behaviour, not just the DOM.

'render' should render, because that's what the function name says. If you're using it for behavior then you're not using it for the intended purpose.
Post reply on HN