adex-platform
adex-platform copied to clipboard
Step by step refactoring
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.
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 is this ready?