Make Reusable React Props Streams with Lenses

Share this video with your friends

Send Tweet

If you hard-code a stream of props to target a specific prop, it becomes impossible to reuse that stream with any other components. Configuring your props stream with lenses will allow you to reuse your stream with any React component.

Stephen James
Stephen James
~ 7 years ago

Your selector function in the typewriter function should probably have a generic name.

      (props, name) => R.set(lens, name, props)

could be

      (props, typedValue) => R.set(lens, typedValue, props)