Question: I am new with JMeter. I am using apache jmeter 5.2 with Java 8. I want to send cookie data in a field name "Cookie" in the request header of a post request at the time of logging in a user to a website. The request header will like the following picture :

[![Cookie data](https://i.stack.imgur.com/jvVO4.jpg)](https://i.stack.imgur.com/jvVO4.jpg)

First of all, I am sending a get request to the server and holding cookie data using regular expression extractor and using the value in request header as a parameter named "Cookie". But unfortunately JMeter doesn't add that parameter with the request header. I have also used HTTP Cookie Manager. But I am getting cookie data in **request body**, but not in **request headers**.

I have already seen the following posts.

[How to generate a cookie and send it in a request in Jmeter](https://stackoverflow.com/questions/40010164/how-to-generate-a-cookie-and-send-it-in-a-request-in-jmeter)

Answer: 
It has nothing to do with the way you update the state. Consider it correct, though I would not recommend to avoid common best practices.  

In your case **render** is not called because component props is not changed...

I believe that you may have something like this:

```
<Component entries={this.props.entries}/>

```

and

```
mapStateToProps = (state) => ({
  entries: state.entries
})

```

If it is so, then `state.entries` is the prop that controls whether your component will be re-rendered or not. If it has the same value during the state change on `ADD_ENTRY` action - the component will not be re-rendered.
So. Get back to roots. Remember that in JavaScript `state.entries` is a **POINTER**, that points to array in memory.  

While you calling `entries.push` the array in memory will be extended with another element - thats for sure. BUT the **POINTER value** that we have in `state.entries` will remain the same. It will be not changed. Thats how `Array.push` works.

As the result `<Component entries={this.props.entries}/>` will not be re-rendered.  

By changing `newState.entries.push("test2");` 
to

```
newState.entries = newState.entries.concat("test2");

```

you actually changing `entries` pointer, component sees that property `props.entries` has changed and now the whole thing re-renders...
You need to use other alternatives because `Object.assign()` copies property values. If the source value is a reference to an object, it only copies that reference value.

You should use a Deep clone.

```
let newState= JSON.parse(JSON.stringify(state));

```