# react/no-unused-state 📝 Disallow definitions of unused state. Warns you if you have defined a property on the state, but it is not being used anywhere. ## Rule Details Examples of **incorrect** code for this rule: ```jsx class MyComponent extends React.Component { state = { foo: 0 }; render() { return ; } } var UnusedGetInitialStateTest = createReactClass({ getInitialState: function() { return { foo: 0 }; }, render: function() { return ; } }) ``` Examples of **correct** code for this rule: ```jsx class MyComponent extends React.Component { state = { foo: 0 }; render() { return ; } } var UnusedGetInitialStateTest = createReactClass({ getInitialState: function() { return { foo: 0 }; }, render: function() { return ; } }) ```