Posts

Showing posts with the label components

Tree shaking css using angular-cli build / schemantics

Tree shaking css using angular-cli build / schemantics I am on an angular-cli project. I am facing an issue with the css. This is somewhat a non-code question and deviates from stackoverflow needs of putting code. But hopefully it will not be marked down for closure. Here is the background: I have a lot of unnecessary css lingering around. I need treeshaking for the unnecessary css during the build process. Is there one that you can help me with. Here is the background of what is happening: Options: I see manual tree shaking is an issue. So I saw there are a few css treeshakers around but since angular cli works with multiple components, I see a need of cli integration of the css tree shaker. I could not find one for cli to merge with build. Questions: Anyone has suggestion on how to integrate or is there a css-tree shaker community project? I have not worked with schmatics. What exactly do you mean by treeshaking unnecessary CSS? Could you provide a generic...

seState not working

seState not working In my app component below I want to hide a div based on a function I have defined but it brings an error saying TypeError: Cannot read property 'setState' of undefined Please what may be wrong class Apps extends Component { constructor(props) { super(props); // Don't do this! this.state = { showing: true }; } render() { return ( <div> <div className="container"> <div style={{ display: (this.state.showing ? 'block' : 'none') }}> A Single Page web application made with react </div> </div> <div className="buttons"> <a href='' onClick={this.onclick} >Login</a> <br/> <a href='' >Signup</a> <br /> ...