1.1.655 • Published 6 years ago

rrsx v1.1.655

Weekly downloads
409
License
-
Repository
github
Last release
6 years ago

Rctx

Example

//Test component
import { importContexts } from 'rctx';
import TestContext from './test-context.ctx';
const TestComponent = props => {
  const { testContext } = props;
  const { add } = testContext;
  return <div onClick={add}>hello world</div>;
};
export default injectContexts(TestComponent, {
  testContext: TestContext
});
	//Test Context
import { ContextComponent createContext ContextStore } from  'rctx';
class  TestContext  extends  ContextComponent{
	state = {value:0}
	add  = () => {
		this.setState(prevState  => {
			return { value:  prevState.value  +  1 };
		});
	}
   }
export  default  createContext(TestContext, { store:  new  ContextStore() /*If you want to preserve the state when component unmount*/ });
//App
import TestContext from './test-context.ctx';
import { importContexts } from 'rctx';
class App extends Component {
  render() {
    return <TestComponent />;
  }
}

export default importContexts(App, [TestContext]);
1.1.655

6 years ago

1.1.654

6 years ago

1.1.653

6 years ago

1.1.652

6 years ago

1.1.651

6 years ago

1.1.65

6 years ago

1.1.649

6 years ago

1.1.648

6 years ago

1.1.647

6 years ago

1.1.646

6 years ago

1.1.645

6 years ago

1.1.644

6 years ago

1.1.643

6 years ago

1.1.642

6 years ago

1.1.641

6 years ago

1.1.640

6 years ago

1.1.639

6 years ago

1.1.638

6 years ago

1.1.637

6 years ago

1.1.636

6 years ago

1.1.635

6 years ago

1.1.634

7 years ago

1.1.633

7 years ago

1.1.632

7 years ago

1.1.631

7 years ago

1.1.630

7 years ago

1.1.629

7 years ago

1.1.628

7 years ago

1.1.627

7 years ago

1.1.626

7 years ago

1.1.625

7 years ago

1.1.624

7 years ago

1.1.623

7 years ago

1.1.622

7 years ago

1.1.621

7 years ago

1.1.620

7 years ago

1.1.619

7 years ago

1.1.618

7 years ago

1.1.617

7 years ago

1.1.616

7 years ago

1.1.615

7 years ago

1.1.614

7 years ago

1.1.613

7 years ago

1.1.612

7 years ago

1.1.611

7 years ago

1.1.61

7 years ago

1.1.60

7 years ago

1.1.59

7 years ago

1.1.589

7 years ago

1.1.588

7 years ago

1.1.587

7 years ago

1.1.586

7 years ago

1.1.585

7 years ago

1.1.584

7 years ago

1.1.583

7 years ago

1.1.582

7 years ago

1.1.581

7 years ago

1.1.58

7 years ago

1.1.57

7 years ago

1.1.56

7 years ago

1.1.55

7 years ago

1.1.54

7 years ago

1.1.53

7 years ago

1.1.52

7 years ago

1.1.51

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago