dataa && l.userId === dataa.id
const deleteUser = () => {
axios.get(`http://localhost:3001/users/${user.id}`)
.then(({ data }) => {
const userData = data
console.log(userData)
axios.get(`http://localhost:3001/lists`)
.then(({ data }) => {
data.map(l => {
if(userData && l.userId === userData.id){
console.log(l)
}
})
})
})
.catch(e => {
alert('Ошибка');
})
}
export const setActiveUser = clientsList => {
return {
type: SET_ACTIVE_USER,
clientsList: ""
};
};
export const setActiveUser = activeClient => {
return {
type: SET_ACTIVE_USER,
payload: activeClient
};
};
export const initialState = {
users: [],
activeUser: null,
filter: ""
};
export const getUsers = clientsList => {
return {
type: GET_USERS,
clientsList: clientsList
};
};
export const initialState = {
users: userList.json,
activeUser: null
}
export default function userReducer = (state = initialState, action) {
const {type, payload} = action
switch (type) {
case SET_ACTIVE_USER:
return {...state, activeUser: payload}
default:
return state
}
}
import {Record} from 'immutable'
export const ReducerRecord = Record({
users: userList.json,
activeUser: null
})
export default function reducer(state = new ReducerRecord(), action) {
const {type, payload} = action
switch (type) {
case SET_ACTIVE_USER:
return state.set('activeUser', payload)
default:
return state
}
}
const customComponent = memo(forwardRef(({ myProp }, ref) => {
// ...
}))
customComponent.propTypes = { prop: PropTypes.number}
default export customComponent;