Another react question: im getting the following warning:
<item android:drawable="@color/colorPrimary" />
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher" />
</item>
render <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LaunchScreen"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
creds = {
"username": "user",
"password": "pw",
"authType": "",
"catalogId": "EE"
}
url = 'https://earthexplorer.usgs.gov/inventory/json/v/1.4.0/login'
r = requests.get(url, params={'jsonRequest':json.dumps(creds)})
print(r.json())
When I click Warning: setState(...): Cannot update during an existing state transition (such as within
that warning shows up. When I click that button it should set or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to componentWillMount.
to nameFormatter: function(id, name) {
if (this.state.editIpsetEnabled && this.state.editIpsetId === id) {
this.setState({'newIpsetName': name});
return (
<input type="text"
value={name}
name="ipsetName"
maxLength="50"
className="newIpsetName"
onChange={this.handleChange} />
);
} else {
return name;
}
}
render: function() {
const tableData = [];
this.state.data.map(row => {
tableData.push(
<tr key={row.id + row.name}>
<td className="col-lg-1 text-center">
{row.id}</td>
<td className="col-lg-3 text-center">
{this.nameFormatter(row.id, row.name)}</td>
);
});
return(
.........
{tableData}
.........
)
}
but it slows down and throws a bunch of warnings. How could i solve it ?