adex-platform icon indicating copy to clipboard operation
adex-platform copied to clipboard

Step by step refactoring

Open ivopaunov opened this issue 6 years ago • 2 comments

We should use react hooks for every new component, start making selectors with reselect using useSelector hook from react-redux. As for the current components, we have to try refactor them when working on them, and no significant extra time will be spend on the refactor. We have to try to keep all the actions and data manipulation out of the components, and they become used only for markup representation.

ivopaunov avatar Oct 24 '19 13:10 ivopaunov

We can put here some tips about hooks, for example:

// simulate `componentDidMount` 
// If you pass empty  array this effect will be triggered once
useEffect(() => { do something }, [])

// for componentWillUnmount return callback function for the effect
useEffect(() => { 
    do something
    return () => { unmount function }
 }, [])
// If nothing is passed the effect will be triggered on every render update
useEffect(() => { do something }, [])
// If you pass some variables from, state, selectors or props, 
// the effect will be triggered if some value is changed
const [dogeStyle, changeStyle] = useState('EMO_METAL')
useEffect(() => { do something }, [dogeStyle])

ivopaunov avatar Oct 25 '19 12:10 ivopaunov

@IvoPaunov is this ready?

Ivshti avatar Mar 10 '21 20:03 Ivshti