True and false radio buttons in react
<p>Here is my current code:</p>

<p>The state in my component</p>

<pre><code>this.state = {
            name: '',
            sample: '',
            description: '',
            isPublished: null,

        };
</code></pre>

<p>Here is the handler for the radio buttons</p>

<pre><code>_handleRadio(event) {
let value = true;
if (typeof event.currentTarget.value === 'string') {
    (event.currentTarget.value === 'true' ? value = true : value = false );
}
this.setState({isPublished: value});
}
</code></pre>

<p>And finally here are my radio buttons</p>

<pre><code>&lt;div className="radio"&gt;
                        &lt;label&gt;&lt;input type="radio" name="isPublished" value="true" onChange={this._handleRadio} /&gt;Yes&lt;/label&gt;
                    &lt;/div&gt;
                    &lt;div className="radio"&gt;
                        &lt;label&gt;&lt;input type="radio" name="isPublished" value="false" onChange={this._handleRadio} /&gt;No&lt;/label&gt;
                    &lt;/div&gt;
</code></pre>

<p>Sorry for the poor formatting, copy and pasting my code over here didn't turn out so well. When I try to fix it, I mess it up even more. </p>

<p>So right now, as is, the state is being changed, which is exactly what I want. But when I submit and make the POST request to my api, the isPublished state returns to true.</p>

<p>Here is my submit handler</p>

<pre><code>_handleSubmit(event) {
        event.preventDefault();
        event.stopPropagation();
        const sampleObj = this.state;
        console.log(sampleObj);

        api.post('samples', sampleObj).done((result) =&gt; {
            console.log('Sample Saved!');
            this.context.router.push(`${result.id}/`);
        }).fail((error) =&gt; {
            console.log('failed');
            console.log(error);
        });
    }
</code></pre>

<p>Why does the state of isPublished return to true during the submit, even after changing it to false? </p>