Create a twitch clone using React -5
2 min readMay 16, 2019
Welcome to Part-5 of the series. You can find part-4 here.
Let’s start where we left. We would like to associate users, to our stream so that we can add a Delete and Edit button for the logged in user, of that stream.
Open the index.js file in src -> actions folder and add the userId in createStream().
export const createStream = formValues => async (dispatch, getState) => {
const { userId } = getState().auth;
const response = await streams.post('/streams', {...formValues, userId});
dispatch({ type: CREATE_STREAM, payload: response.data })
}
Now, move to http://localhost:3000/streams/create and create a new stream.