FRONT-END 2020

CHAPTER NEXT STEPS

MASMOVIL TECHNOLOGY

#frontend-general | #tech-chat

My biggest accomplishment in 2019 was:

 

....................................

Fill the gap

ROAD TO 2020

Typescript

React ♥ Typescript

import React from 'react'

interface HeaderProps {
  name: string;
  color: string;
}

type OtherHeaderProps = {
  name: string;
  color: string;
}

// Notice here we're using the function declaration with the interface Props
function Header({ name, color }: HeaderProps): React.ReactNode {
  return <h1>My Website Heading</h1>
}

// Notice here we're using the function expression with the type OtherProps
const OtherHeader: React.FC<OtherHeaderProps> = ({ name, color }) =>
  <h1>My Website Heading</h1>

React components

React ♥ Typescript

import React from 'react';

type ButtonProps = {
    /** the background color of the button */
    color: string;
    /** the text to show inside the button */
    text: string;
}

type ContainerProps = ButtonProps & {
    /** the height of the container (value used with 'px') */
    height: number;
}

const Container: React.FC<ContainerProps> = ({ color, height, width, text }) => {
  return <div style={{ backgroundColor: color, height: `${height}px` }}>{text}</div>
}

Typed props

React ♥ Typescript

import React from 'react';

interface ButtonProps {
    /** the background color of the button */
    color: string;
    /** the text to show inside the button */
    text: string;
}

interface ContainerProps extends ButtonProps {
    /** the height of the container (value used with 'px') */
    height: number;
}

const Container: React.FC<ContainerProps> = ({ color, height, width, text }) => {
  return <div style={{ backgroundColor: color, height: `${height}px` }}>{text}</div>
}

Typed props 2

React ♥ Typescript

import React from 'react'

const MyInput = () => {
  const [value, setValue] = React.useState('')

  // The event type is a "ChangeEvent"
  // We pass in "HTMLInputElement" to the input
  function onChange(e: React.ChangeEvent<HTMLInputElement>) {
    setValue(e.target.value)
  }

  return <input value={value} onChange={onChange} id="input-example"/>
}

Synthetic events

React ♥ Typescript

State Management

RE-

DUX

State Management

RE-

DUCKS

What about TS?

Async State Management

NGRX

Async State Management

Redux- Observable

NGRX

MONOREPO

MONOREPO

Deterministic

Reproducible

Incremental

Tooling

Versioning

Deployment

PULL REQUEST

PULL REQUEST

Code complexity will always increase.

Only working on it actively will help to reduce it.

me, just right now

FEATURE FLAGS

Predictable
Consistent
Reactive
Shareable

If we merge this PR can be deployed anytime to prod?

See you at

TO TAKE AWAY

B

F

F

Best

Friends

Forever

Backend

For

Frontend

Duplication > BAD Abstractions

Runtime Config

  • Same artefact, N deployments

  • Blazing fast rollbacks

  • Devops Friendly

+ Storybook

+ Unit tests

+ Integration tests

- Functional tests

 

Query Params

Preserve query params as default

  • History API override
  • Extended anchors

Why?

  • Attribution model
  • Feature flags

Who creates/need it should remove it after

Q&A

#frontend-general | #tech-chat

Thanks!