I'm using functional components and React-Redux to manage state. Simply speaking, I hope that even if the state changes, rendering will not happen. First of all, the code is as follows. It is a simple code for explanation.
const NOUPDATE = ({ uploadAnswer, noState }) => (
<>
<div className="content">
<div className="container">
<p className="directions" />
<ul className="qbox">{noState ? (<p>true</p>) : (<p>false</p>)}</ul>
<button onClick={uploadAnswer}>upload</button>
</div>
</div>
</>
);
const mapStateToProps = state => ({
noState: state.problemInfoReducer.checkMode,
});
const mapDispatchToProps = dispatch => ({
uploadAnswer: value => dispatch(uploadAnswer(value)),
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(NOUPDATE);
uploadAnswer reverses noState each time it is dispatched. So if I dispatch uploadAnswer every time, noState is updated, and the screen is re-rendered as a whole. I don't want the screen to be re-rendered even if noState is updated.