Making Nullstack framework able to read any template vocable you type
Run this command on your Nullstack project:
npm install nullstack-polyable -Dor, using Yarn:
yarn add nullstack-polyable -DThen import it in your client.js/server.js files (as shown here in tests/index.js):
Showing usage changing element types and attributes to pt-BR
importpolyablefrom'nullstack-polyable';Nullstack.use(polyable({types: {button: 'botão',input: 'entrada'},attributes: {onclick: 'aoclicar',oninput: 'aoteclar'}}));Everything can be seen being used on tests folder
After the configuration, the use become this:
exibe({ ação }){// it will show the attribute from the elementconsole.log(ação);}renderiza(){const{ exibe }=this;return(<><botãoaoclicar={exibe}ação="clicado!">
Clique aqui
</botão><entradaaoteclar={exibe}ação="digitado!"/></>)}// just to see where it goes,// using pt-BR in lifecycle hooks and the render functionprepare=this.prepara;console=this.exibe;render=this.renderiza;